Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Using GraphQLObjectTypes with makeExecutableSchema? #398
I'm trying to use
I've gotten around this with an ugly hack. I convert the
Obviously, there's a huge amount of wasted work being done here.
Ideally, I wonder if it would be possible for
I'd love to hear your opinions, or if there's a better way to accomplish what I'm trying to do.
Yeah - if you already have a schema written up with object types, there's no big reason to use
There have been a lot of feature requests for combining string schemas with ones defined using the underlying GraphQL.js objects, or generated from tools; but it's a bit hard from a technical standpoint. Definitely open to ideas and contributions about how to make that happen.
In my case I already had my schema written up in schema language (i.e. graphql-tools approach) and wanted to add some mongoose capabilities for occasional server-side data operations. Rather than ditching graphql-tools (a lot of work to rewrite the schema) I'm just adding mongoose models on the side..they are almost identical to graphql types so it's mostly a copy/paste job to generate mongoose models from schema language types. Granted it's not ideal to have such code duplication but this was a practical matter. Also, putting the types / models duplication aside, I'm partial to leaving my queries / mutations written in schema language...i.e. graphql-tools has value there to me.
If anyone comes up with a better approach to the predicament of incorporating mongoose with graphql-tools, I'd be curious.
For the long term, ideally graphql-tools would incorporate the logic from a package like mongoose-schema-to-graphql so that we can continue to create query and mutation schemas in schema language and optionally re-use models in mongoose i.e. eliminate code-duplication (duplication of graphql types and mongoose models for this use case).