Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL validation fail with graphql-js #4893

Open
suyeon-jung-dev opened this issue Sep 19, 2024 · 0 comments · May be fixed by #4894
Open

GraphQL validation fail with graphql-js #4893

suyeon-jung-dev opened this issue Sep 19, 2024 · 0 comments · May be fixed by #4894
Assignees

Comments

@suyeon-jung-dev
Copy link
Contributor

suyeon-jung-dev commented Sep 19, 2024

What happened:
When I try to build the GraphQL documentation using Spectaql, the build fails during the GraphQL schema validation. I will attach the error trace below.

Error: Cannot extend type "Query" because it is not defined.
Cannot extend type "Mutation" because it is not defined. Did you mean "Annotation" or "Invitation"?
Cannot extend type "Subscription" because it is not defined.
Unknown type "Query".
Unknown type "Mutation". Did you mean "Annotation" or "Invitation"?
Unknown type "Subscription".
    at assertValidSDL (/opt/homebrew/lib/node_modules/spectaql/node_modules/graphql/validation/validate.js:135:11)
    at buildASTSchema (/opt/homebrew/lib/node_modules/spectaql/node_modules/graphql/utilities/buildASTSchema.js:44:34)
    at makeExecutableSchema (/opt/homebrew/lib/node_modules/spectaql/node_modules/@graphql-tools/schema/cjs/makeExecutableSchema.js:73:47)
    at loadSchemaFromSDLFile (/opt/homebrew/lib/node_modules/spectaql/dist/spectaql/graphql-loaders.js:112:49)
    at buildSchemas (/opt/homebrew/lib/node_modules/spectaql/dist/spectaql/build-schemas.js:52:47)
    at run (/opt/homebrew/lib/node_modules/spectaql/dist/spectaql/index.js:58:78)
    at loadData (/opt/homebrew/lib/node_modules/spectaql/dist/index.js:566:10)
    at run (/opt/homebrew/lib/node_modules/spectaql/dist/index.js:339:65)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/spectaql/bin/spectaql.js:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49

According to the GraphQL JavaScript documentation, a GraphQL schema must include root types (queries, mutations, and subscriptions). Therefore, I suggest changing one of the existing operators in the Chaoscenter GraphQL server schema to a root type.

What you expected to happen:
I expected the GraphQL documentation to build successfully without any validation errors.

Where can this issue be corrected? (optional)

It would be good to change the extended operation types in the chaos_infrastructure.graphqls file to root types.

How to reproduce it (as minimally and precisely as possible):

  1. Install spectaQL. Reference is [here](ref. https://github.com/anvilco/spectaql?tab=readme-ov-file)
npm install -g spectaql
# OR
yarn global add spectaql
  1. Generate document with this command.
npx spectaql config.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants