JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

False positive schema inspection error for inspection 'Interface implementation' #563

Closed j-riebe closed 2 years ago

j-riebe commented 2 years ago

Describe the bug The schema inspection "Interface implementation" is to strict.

False positive error with message:

The object type 'AorBEdge' has tried to redefine field 'node' defined via interface 'Edge' from 'Node!' to 'StricterNode!'

The redifinition of the 'node' fields return type should be allowed, because the new return type 'StricterNode' implements the 'Node' interface (just a refinement).

The inspection seems to raise an error if any redefinition of a field defined by an interface is attempted. Instead it should check, whether or not the new type is a refinement of the original return type.

To Reproduce

interface Node {
  id: ID!
}

interface Edge {
  cursor: String!
  node: Node!
}

interface StricterNode implements Node {
  id: ID!
}

type A implements StricterNode & Node {
  id: ID!
}

type B implements StricterNode & Node {
  id: ID!
}

type AorBEdge implements Edge {  # <-- False positive appears here, see screenshot.
  cursor: String!
  node: StricterNode!
}

Expected behavior This is valid GraphQL-SDL, so there is no error to detect. Validity of SDL was ensured by executing this schema with pythons ariadne library, which results in no error.

Screenshots grafik

Version and Environment Details Operation system: [Windows10] IDE name and version: [pyCharm 2021.3] Plugin version: [3.1.1]