forked from graphql/graphql-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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"`
- Loading branch information
1 parent
ed7ab3e
commit 514148e
Showing
5 changed files
with
94 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters