graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

Ignore types coming from super graph

Open gituserjava opened this issue 2 years ago • 5 comments

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.

gituserjava avatar Sep 29 '23 22:09 gituserjava

you can use eslint-ignore directive comments for example

dimaMachina avatar Sep 29 '23 23:09 dimaMachina

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
}

gituserjava avatar Sep 30 '23 02:09 gituserjava

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

dimaMachina avatar Sep 30 '23 03:09 dimaMachina

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 avatar Oct 01 '23 01:10 gituserjava

@B2o5T, any work around for this?

gituserjava avatar Oct 03 '23 19:10 gituserjava