Modularising Types in graphql-yoga based server
See original GitHub issueI am trying to modularise resolvers and typeDefs in separate files using merge-graphql-schemas. They are successfully merged but I am getting the error
Error: Type "Course" not found in document. at ASTDefinitionBuilder._resolveType (/Users/alosiesgeorge/Desktop/vue-code/prisma-tutorial/hello-world/server-graphql/node_modules/graphql/utilities/buildASTSchema.js:134:11)
Folder Structure
src/graphql/types/courseManagement/courseType.graphql
src/graphql/types/courseManagement/sectionType.graphql
src/graphql/types/index.js
src/index.js
In Prisma tutorial they say to reference # import User from ‘./generated/prisma.graphql’ on the top of schema.graphql. Where do I reference the same in this modularisation pattern?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
Modularising Types in graphql-yoga based server #332 - GitHub
I am trying to modularise resolvers and typeDefs in separate files using merge-graphql-schemas. ... Modularising Types in graphql-yoga based server #332.
Read more >Getting Started – GraphQL Yoga
How does that help in defining the API for a GraphQL server, though? Every GraphQL schema has three special root types: Query ,...
Read more >GraphQL Modules tutorial: How to modularize GraphQL schema
In this tutorial, we'll show you how to use GraphQL Modules to break your GraphQL application into simple, reusable, feature-based modules.
Read more >How To Build a GraphQL Server in Node.js ... - DigitalOcean
We have three types inside our Schema, let's break them down. Using the Query Type. A GraphQL query is for fetching data and...
Read more >Setting Up A Graphql Server With Node + Graphql-Yoga + ...
resolvers. A resolver is a function that connects schema fields and types to various backends. Resolvers provide the instructions for turning a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m also curious about how to solve this! Modularizing works just fine for my own .graphql-files but I haven’t been able to incorporate the types defined in the src/generated/prisma.graphql-file. Surely it would be reasonable for the modular-resolvers-example to showcase how to do this?
I’m having the same issue, even after using the
# import
directives.I tried to use
importSchema
(https://github.com/prismagraphql/graphql-import) directly passing the imported types tomergeTypes
, but it failed because of https://github.com/okgrow/merge-graphql-schemas/issues/141 (interfaces don’t get merged, so I get anError: Type "Node" was defined more than once.
).I think it would help a lot to newcomers if the modular-resolvers example also showed how to import types (I’d try helping if I wasn’t struggling with this myself).