简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM