Graphql-yoga: Modularising Types in graphql-yoga based server

Created on 22 May 2018  路  8Comments  路  Source: dotansimha/graphql-yoga

I 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
screen shot 2018-05-22 at 9 50 33 pm

src/graphql/types/courseManagement/courseType.graphql

screen shot 2018-05-22 at 9 58 25 pm

src/graphql/types/courseManagement/sectionType.graphql

screen shot 2018-05-22 at 9 59 34 pm

src/graphql/types/index.js

screen shot 2018-05-22 at 10 00 36 pm

src/index.js
screen shot 2018-05-22 at 10 05 02 pm

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?

kinquestion statustale

Most helpful comment

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?

All 8 comments

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 to mergeTypes, but it failed because of https://github.com/okgrow/merge-graphql-schemas/issues/141 (interfaces don't get merged, so I get an Error: 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).

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?

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

Hey :wave:, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we'll close it.
Feel free to reopen it at any time if you believe we should futher discuss its content. :slightly_smiling_face:

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

Hey :wave:, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we'll close it.
Feel free to reopen it at any time if you believe we should futher discuss its content. :slightly_smiling_face:

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

Hey :wave:, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we'll close it.
Feel free to reopen it at any time if you believe we should futher discuss its content. :slightly_smiling_face:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

asci picture asci  路  3Comments

kv-pawar picture kv-pawar  路  3Comments

ramonmulia picture ramonmulia  路  3Comments

anthonymetzler picture anthonymetzler  路  4Comments

checkmatez picture checkmatez  路  5Comments