You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal adds a null literal to the GraphQL language and allows it to be provided to nullable typed arguments and input object fields.
This presents an opportunity for a GraphQL service to interpret the explicitly provided null differently from the implicitly not-provided value, which may be especially useful when performing mutations using a per-field set API.
For example, this query may represent the removal/clearing of the "bar" field from thing with id: 4.
```
mutation editThing {
editThing(id: 4, edits: { foo: "added", bar: null }) {
# ...
}
}
```
In addition to allowing `null` as a literal value, this also proposes interpretting the variables JSON to distinguish between explicit null and implicit not provided:
```
mutation editThing($edits: EditObj) {
editThing(id: 4, edits: $edits) {
# ...
}
}
```
This variables results in the unsetting of `bar`
```
{ "edits": { "foo": "added", "bar": null } }
```
Finally, this proposes following the not-provided-ness of variables to their positions:
```
mutation editThing($editBaz: String) {
editThing(id: 4, edits: { foo: "added", bar: null, baz: $editBaz }) {
# ...
}
}
```
Such that the three variables are semantically different:
* `{}` The "baz" input field is "not provided"
* `{"editBaz": null}` The "baz" input field is `null`
* `{"editBaz": "added"}` The "baz" input field is `"added"`
0 commit comments