dimaMachina / graphql-eslint

ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
https://the-guild.dev/graphql/eslint
MIT License
798 stars 104 forks source link

Ignore types coming from super graph #1904

Open gituserjava opened 1 year ago

gituserjava commented 1 year ago

We use super graph and some types and inputs may not be available in the current Graph QL schema that we are validating however we will be extending from type defined in super graph as shown in example below, in such a case how can I avoid below two errors? I want to still apply other rules around naming convention, field descriptions etc on the types defined in sub graph. Please advise.

Example: Super graph

type Product {

id: String;

}

Sub Graph

extend type Product{
productName: String
}

Errors: Unknown type "Product". Did you mean "Product"? Cannot extend type "Product" because it is not defined.

dimaMachina commented 1 year ago

you can use eslint-ignore directive comments for example

gituserjava commented 1 year ago

No this did not work for me, what is the syntax to use in Graph ql schema files? I am trying as below, please advise.

# eslint-ignore

extend type Product{
productName: String
}
dimaMachina commented 1 year ago

Same as in eslint : # eslint-disable-next-line

gituserjava commented 1 year ago

No this did not work and I believe it is because the graph ql schema is trying to find the parent schema to prepare the consolidated schema. Is there a workaround for this?

Cannot extend type "Product" because it is not defined.

gituserjava commented 1 year ago

@B2o5T, any work around for this?