Graphql-tools: Throw an error when a resolver is defined in the schema, but not in the resolvers

Created on 11 Apr 2017  路  1Comment  路  Source: ardatan/graphql-tools

Right now when you define a resolver but have no types in the schema for it graphql-tools throws an error like "Found resolver post.getExcerpt, but no type definition for it".

It'd be great if this existed the other way around too, when you have a type defined on Query/Mutation/Subscription that doesn't have a resolver!

Most helpful comment

@mxstbr we actually used to have that, but most people didn't want it, because they used the default resolver in a lot of places, so we ended up getting rid of it.

makeExecutableSchema has a resolverValidationOptions option in which you can change that default so it throws errors if resolvers are missing:

makeExecutableSchema({ typeDefs, resolverValidationOptions: { requireResolversForAllFields: true } });

I hope that's what you were looking for! 馃檪

>All comments

@mxstbr we actually used to have that, but most people didn't want it, because they used the default resolver in a lot of places, so we ended up getting rid of it.

makeExecutableSchema has a resolverValidationOptions option in which you can change that default so it throws errors if resolvers are missing:

makeExecutableSchema({ typeDefs, resolverValidationOptions: { requireResolversForAllFields: true } });

I hope that's what you were looking for! 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brennantaylor picture brennantaylor  路  4Comments

tonyxiao picture tonyxiao  路  4Comments

dcworldwide picture dcworldwide  路  4Comments

ericclemmons picture ericclemmons  路  4Comments

BassT picture BassT  路  3Comments