Skip to content

Key Field(s) '[id]' are not queried on XUnion at Operation(XQuery).union #141

Closed
@sonatard

Description

@sonatard

Version

3.8.2

Summary

I have set the extend interface Node @typePolicy(keyFields: "id").

And when I build, the following error occurs.
Key Field(s) '[id]' are not queried on X2 at Operation(XQuery).union

Steps to reproduce the behavior

union X = X1 | X2

type Query {
 x: X!
}

type X1 {
 id: ID!
 name: String
}

type X2 {
 id: ID!
 name: String
}
extend interface Node @typePolicy(keyFields: "id")
query XQuery {
  x {
    ... on X1 {
       id
       name
    }
  }
}
  • build
`Key Field(s) '[id]' are not queried on X2 at Operation(XQuery).union`

I found a workaround. By modifying the Query as follows, the error disappears.

query XQuery {
  x {
    ... on X1 {
       id
       name
    }
    ... on X2 {
       id
    }
  }
}

Logs

Key Field(s) '[id]' are not queried on X2 at Operation(XQuery).union

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions