federation
federation copied to clipboard
Supporting multiple @key s where some of them are nullable
Inside service vendors the entity looks like:
type Vendor @key(fields: "id") @key(fields: "integrationType") {
id: ID!
integrationType: IntegrationType
name: String!
}
as you can see integrationType is nullable.
in other service, users ,
we want to reference Vendor which is defined this way:
type Vendor @key(fields: "integrationType", resolvable: false) @key(fields: "id", resolvable: false) {
integrationType: IntegrationType
id: ID!
}
we want to be able to resolve Vendor from users service by id in some cases and by integrationType in some other cases.
because the id of vendor defined as non-nullable in users, once referencing it by integrationType the query returns
Cannot return null for non-nullable field Vendor.id..
Is this case of having nullable fields on entity even supported?
Thanks for raising this issue! Could you provide a repo so we can reproduce this problem?