Open duckki opened 8 months ago
One thing to consider here is if we lift this restriction then adding implements I
to type A
would be a breaking change, since a previously valid query:
query ValidationRejected {
get {
...on A {
f(arg: "a")
}
...on I {
f(arg: "b")
}
}
}
would now be invalid.
(Not saying this is a blocker, just one thing to keep in mind when considering trade-offs.)
Arguably, this is a weird corner case, where union and interface types are mixed on the same type.
https://github.com/graphql/graphql-spec/issues/367 seems remotely related, but a different rule ("Fragment Spread Is Possible").
(This idea was inspired by https://github.com/apollographql/federation/issues/2952 .)
Motivating example
Schema:
Accepted query:
Rejected query:
This query is rejected by GraphQL.js's validator, complaining that
f(arg: "a")
andf(arg: "b")
are conflicting.This is disappointing because it discourages using interface-conditioned fragments like
genericFragment
above under a more derived type context (like...on B
).Potential improvement in [FieldsInSetCanMerge](https://spec.graphql.org/draft/#FieldsInSetCanMerge())(set)
The current
FieldsInSetCanMerge
rule only looks at the (immediate) parent type of fields when checking if they can merge.I propose to change
FieldsInSetCanMerge
rule to check:where