Skip to content

Generator does not issue errors (silences them) for the documents with syntax errors #10593

@Mr-Goldberg

Description

@Mr-Goldberg

Is your feature request related to a problem? Please describe.

When the file with `gql`` directive has a syntax error in GraphQL, the file is skipped completely from the generation process and NO ERROR GETS REPORTED.

For example, error in the word 'query' is not reported, and the whole file is skipped:

const _ContractQueries = gql`
  que ry Contracts($input: ContractConnectionInput!) {
      <some more lines>
  }
`

Describe the solution you'd like

As mentioned here, the issue can be resolved by setting noSilentErrors: true in the config file. But I don't like this solution, because the process of understanding that there's any error is very time-consuming:

  1. There's no knowledge that there's an error - trying to re-generate GraphQL wrapper, restarting terminal, IDE, computer, as something might be off on my side.
  2. Idea "there might be an error" - deleting the parts in the `gql`` directive to understand where the error is. After the error is found:
  3. There was an error; it is the CRITICAL error (since it skips generation), but why was it not reported? And searching for the way to make the generator report errors...

It just takes time for any user to encounter it 🤷. Error reporting must be enabled by default for the errors of such magnitude.

Describe alternatives you've considered

No response

Any additional important details?

Using the latest versions of everything:

"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/typescript": "^5.0.7",
"@graphql-codegen/typescript-operations": "^5.0.7",
"@graphql-codegen/typescript-react-apollo": "^4.4.0",

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions