Reputation: 198178
When I work on a graphql project, I like the type-graphql way: use classes and decorators to create GraphQL schemas.
But now I have a problem: we need to use some GraphQL schemas which are defined from another package. They don't use type-graphql, and provided some schema objects of GraphQLObjectType.
In type-graphql resolvers, it seems like we have to use the classes we defined by type-graphql decorators.
Is it possible to make them work together? How to write a resolver for existing GraphQL schema in type-graphql?
Upvotes: 3
Views: 346
Reputation: 12077
You can try to use some utils to merge the schemas:
https://github.com/Urigo/merge-graphql-schemas
TypeGraphQL was not designed to dynamically add fields to existing object types which are graphql-js
constructs, not a class with proper types.
Upvotes: 1