Now lets say I want to add a new optional argument to the Location.photo field. If I make this optional or specify a default this is not a breaking change for clients and would be accepted in a monograph as valid, however with composition this now fails
Subgraph 1
type Query {
locations: [Location]
}
type Location @key(fields: "id") {
id: ID!
name: String!
photo(smallVersion: Boolean): String! # New optional arg shouldn't break existing clients
}
In order to fix this I need to go to every subgraph reference and update those as well
Subgraph 1
type Query {
locations: [Location]
}
type Location @key(fields: "id") {
id: ID!
name: String!
photo(smallVersion: Boolean): String! # New optional arg shouldn't break existing clients
}
Subgraph 2 ✅ (passes composition)
type Location @key(fields: "id") {
id: ID!
photo(smallVersion: Boolean): String! @external # Need to update reference here and in every subgraph (blocking composition pipeline)
banner: String @requires(fields: "photo")
}
What I would like to happen
Instead it would be nice if composition recognized when we are only referencing fields with optional arguments and not including them will not break any operations.
Caveat
There is a bit of a work around today which I am not sure is intentional or not, but you can actually add the reference first to the @external field only and this will not break composition, then you can go and add it to the source field.
Lets say I have this schema today which does compose ✅
Location.photo
that accepts zero arguments today@external
@requires
Subgraph 1
Subgraph 2
Now lets say I want to add a new optional argument to the
Location.photo
field. If I make this optional or specify a default this is not a breaking change for clients and would be accepted in a monograph as valid, however with composition this now failsSubgraph 1
Subgraph 2 ❌ (fails composition)
In order to fix this I need to go to every subgraph reference and update those as well
Subgraph 1
Subgraph 2 ✅ (passes composition)
What I would like to happen
Instead it would be nice if composition recognized when we are only referencing fields with optional arguments and not including them will not break any operations.
Caveat
There is a bit of a work around today which I am not sure is intentional or not, but you can actually add the reference first to the
@external
field only and this will not break composition, then you can go and add it to the source field.