Hello,
I am trying to federate a type on our monolith, but when I try to reference it from another subgraph, I get flooded with errors about the monolith not specifying a key.
monolith
type MyEntityType implements SomeInterface @key(fields: "id") {
id: ID!
name: String
}
subgraph B
type MyEntityType @key(fields: "id") {
id: ID!
}
type Mutation {
someMutation(id: String!): MyEntityType!
}
when I attempt to publish my schema to the managed federated graph I get errors like
SATISFIABILITY_ERROR: The following supergraph API query:
mutation {
someMutation(id: "A string value") {
name
}
}
cannot be satisfied by the subgraphs because:
- from subgraph "B":
- cannot find field "MyEntityType.name".
- cannot move to subgraph "monolith", which has field "MyEntityType.name", because type "MyEntityType" has no @key defined in subgraph "monolith".
When I use studio to look at my schema and check “Only show entities”, MyEntityType does not appear.
What am I doing wrong?
This is apollo server v3
I found this thread from last year. Is what I’m trying to do here even possible? Man I’ll be so bummed if it isn’t.
I found this documentation which seems to suggest tagging the interface with @key, but attempting to do so yields the error: @key is not yet supported on interfaces
Yea now I’m really confused. The code base for composition-js
has this test case
interface I @key(fields: "id") {
id: ID!
x: Int
}
type A implements I @key(fields: "id") {
id: ID!
x: Int
u: U
}
but then if you actually tried to use that, you’d get the @key is not yet supported on interfaces
.
What?