Commit ba75e25
authored
In GraphQL Federation, when a field has @requires dependencies on
external nullable field and those dependencies fail to resolve,
the entire entity resolution would lead to malformed data being sent
to later fetches.
For example, 2 subgraphs:
# Subgraph 1
type Entity @key(fields: "id") {
id: ID
info: String
}
# Subgraph 2, where fullInfo requires
# the "info" field to be resolved first.
type Query {
entity: [Entity]
}
type Entity @key(fields: "id") {
id: ID
info: String @external
fullInfo: String @requires(fields: "info")
}
If the fetch from Subgraph1 returned the null value for
the "info" field along with error pointing to that field, then
this bit of information should not be used in the fetch
from Subgraph 2 that provides info to get the value of
the "fullInfo" field.
This change implements validation of optional @requires dependencies
in GraphQL Federation. The core feature allows the system to
gracefully handle scenarios where entities fail to resolve their
@requires dependencies, particularly for nullable fields.
This change introduces selective handling where only nullable @requires
fields are treated as "optional" - if they fail,
the entity is marked as "tainted" but
processing continues for other entities.
1 parent bca665a commit ba75e25
14 files changed
Lines changed: 2114 additions & 92 deletions
File tree
- execution/engine
- v2/pkg/engine
- datasource/graphql_datasource
- plan
- resolve
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
55 | 95 | | |
56 | 96 | | |
57 | 97 | | |
| |||
0 commit comments