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

ignoreNoDocuments suppresses errors #9915

Open
karol-bisztyga opened this issue Apr 5, 2024 · 0 comments
Open

ignoreNoDocuments suppresses errors #9915

karol-bisztyga opened this issue Apr 5, 2024 · 0 comments

Comments

@karol-bisztyga
Copy link

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

When ignoreNoDocuments flag is set to true in the graphql config, the errors from existing files are not shown to the console, and the graphql-codegen command exits with code 0.

From the docs:

ignoreNoDocuments - A flag to not exit with non-zero exit code when there are no documents

So it seems to ignore errors not only when there are no documents but also when there are documents with errors.

Your Example Website or App

NN

Steps to Reproduce the Bug or Issue

This graphql code is correct:

mutation someMutation {
  xxx {
    set(
      input: { ... }
    )
  }
}

And this one is not:

mutation someMutation() {
  xxx {
    set(
      input: { ... }
    )
  }
}

The error should be something like expected $, got ). With ignoreNoDocuments: true there is no error but the output files are invalid, with that flag set to false the error is thrown properly.

Expected behavior

The error should be something like expected $, got ). With ignoreNoDocuments: true there is no error but the output files are invalid, with that flag set to false the error is thrown properly.

Screenshots or Videos

No response

Platform

  • OS: macOS Ventura 13.5.2 (22G91)
  • NodeJS: v18.17.1
  • graphql version: 15.8.0
  • @graphql-codegen/* version(s): 5.0.2

Codegen Config File

import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  schema: '[...]',
  documents: ['src/**/*.{ts,tsx,graphql}'],
  generates: {
    './src/__generated__/': {
      preset: 'client',
      plugins: [],
      presetConfig: {
        gqlTagName: 'gql',
      },
    },
    './src/__generated__/queries.ts': {
      plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
    },
  },
  ignoreNoDocuments: true,
};

export default config;

Additional context

NN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant