Issue Description
Given:
- Subgraphs "A" and "B," where both define an entity
T, with a @key of id
- "A" defines field
T.a
- "B" defines fields
T.b and T.c, where T.c @requires T.a
When executing a query that conditionally selects T.c, and unconditionally selects other, sibling fields on the entity (T) provided by the same subgraph ("B"), as in:
query q($v: Boolean!) {
t {
id
b
c @skip(if: $v)
}
}
and v is the value true
Then:
T.b is never fetched, and is subsequently resolved to null, which can lead to inconsistent data responses.
Cause
The query plan executor receives a FetchNode with requirements (selection set) that include the field required by the excluded (via @skip) field, and the representation collection process (via executeSelectionSet()) attempts to extract that "required" field from the fetched entity data, in which it is (correctly) excluded. This results in null being returned for the fetch's selection set, and a "silent failure" in the case of null-able fields.
Link to Reproduction
https://codesandbox.io/p/devbox/fldc84
Reproduction Steps
- If not already running (should be in CodeSandbox), start all services with:
- In a free terminal, send example request to reproduce the bug with:
Issue Description
Given:
T, with a@keyofidT.aT.bandT.c, whereT.c@requiresT.aWhen executing a query that conditionally selects
T.c, and unconditionally selects other, sibling fields on the entity (T) provided by the same subgraph ("B"), as in:and
vis the valuetrueThen:
T.bis never fetched, and is subsequently resolved tonull, which can lead to inconsistent data responses.Cause
The query plan executor receives a
FetchNodewith requirements (selection set) that include the field required by the excluded (via@skip) field, and the representation collection process (viaexecuteSelectionSet()) attempts to extract that "required" field from the fetched entity data, in which it is (correctly) excluded. This results innullbeing returned for the fetch's selection set, and a "silent failure" in the case of null-able fields.Link to Reproduction
https://codesandbox.io/p/devbox/fldc84
Reproduction Steps