ardatan / graphql-import

Import & export definitions in GraphQL SDL
868 stars 56 forks source link

Field error while building schema on newest version. #530

Closed LazerJesus closed 4 years ago

LazerJesus commented 4 years ago

the current version of this package throws:

database_1         | Error: Field login: Couldn't find type AuthPayload in any of the schemas.
database_1         |     at collectNode (/opt/api/node_modules/@graphql-toolkit/core/index.cjs.js:642:23)
database_1         |     at newDefinition.fields.forEach.field (/opt/api/node_modules/@graphql-toolkit/core/index.cjs.js:589:13)
database_1         |     at Array.forEach (<anonymous>)

fixed with: npm i graphql-import@1.0.0-130487b.0

ardatan commented 4 years ago

@FinnFrotscher Could you share a reproduction?

LazerJesus commented 4 years ago

sorry, i have moved past the issue by locking a specific version. I posted here to give you a heads up and provide a solution to anyone running into the same issue. what i can tell you is that i use multiple layers of composition. Top down: I import all schema files recursively like this: importSchema("./../*.gql") I have one schema.gql file that contains a bunch of import statements like

# import AuthPayload from "../resolvers/auth/schema.gql"
# import Query from "query.gql"

all my types are defined in various files.