Daniel Flores
Daniel Flores

Reputation: 770

Is it possible to use type-graphql buildSchema method with classes annotated with @Resolver from nestjs/graphql?

I'm trying to mock my schema generated with NestJS, the resolvers are using the @Resolver annotation from @nestjs/graphql.

I've seen that to mock an schema you need to use addMockFunctionsToSchema method, so for building it, I'm using the buildSchema from type-graphql but I'm getting an Error: Generating schema error.

Is it because nestjs don't use the same @Resolver annotation than type-graphql ?

Thanks

Upvotes: 0

Views: 838

Answers (1)

Michał Lytek
Michał Lytek

Reputation: 12087

Try to console.log the "Generating schema error" and check the reason in error.originalError property.

Without resolvers you have no Query type so the schema won't work with graphql-js. You might pass the skipCheck option to the buildSchema to get only the types.

Upvotes: 1

Related Questions