Installing graphiql breaks graphql-codegen schema validation [closed]

Which packages are impacted by your issue?
@graphql-codegen/cli

Describe the bug
Running yarn codegen after installing graphiql package throws syntax error:

Expected Name, found "}".

if graphiql package is removed, everything works fine.

Document.graphql file

query ExampleQuery {
  company {
    ceo
  }
  roadster {
    apoapsis_au
  }
}

codegen cli error

✔ Parse Configuration
❯ Generate outputs
✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to ./src/types/graphql.ts
    ✔ Load GraphQL schemas
    ✖ Syntax Error: Expected Name, found "}".
    ◼ Generate
error Command failed with exit code 1.

Here is a codesandox for the issue
codesandbox : link

Steps to Reproduce the Issue:

  1. Open terminal
  2. Run yarn codegen
  3. Now remove graphiql packages
  4. Run yarn codegen

I can’t figure out what is causing this. Probably some nested dependency issues?
I need both of these packages as I need a playground for our customers to try our graphql endpoints. I should be able to run the yarn codegen without any error.

Adding a codesandbox as reproduction can be easy.: link might have to fork it to use the terminal

  • 1

    The URL shortener does not work for me. Could you change that to the real link? (Better yet, please also add the code into the question, so that it will still make sense if the links break).

    – 




  • 1

    @halfer codesandbox.io/p/sandbox/fragrant-bird-6n72vc might have to fork it to try the terminal. also, updated the issue

    – 




Leave a Comment