Skip to content

Commit b24ce32

Browse files
committed
language updated
1 parent f9f5e2f commit b24ce32

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

spec/Section 2 -- Language.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,17 @@ NullabilityModifier :
530530
Fields can have their nullability designated with either a `!` to indicate that a
531531
field should be `Non-Nullable` or a `?` to indicate that a field should be
532532
`Nullable`. These designators override the nullability set on a field by the schema
533-
for the operation where they're being used. For example, a field marked with `!` in
534-
a query will be treated identically to a field marked with `!` in the schema for the
535-
purposes of validation and execution.
533+
for the operation where they're being used. In addition to being `Non-Nullable`,
534+
if a field marked with `!` resolves to `null`, it propagates to the nearest parent
535+
field marked with a `?` or to `data` if one does not exist. An error is added to
536+
the `errors` array identical to if the field had been `Non-Nullable` in the schema.
536537

537538
In this example, we can indicate that a `user`'s `name` that could possibly be
538-
`null`, should not be `null`:
539+
`null`, should not be `null` and that `null` propagation should halt at the `user` field:
539540

540541
```graphql example
541542
{
542-
user(id: 4) {
543+
user(id: 4)? {
543544
id
544545
name!
545546
}
@@ -609,8 +610,13 @@ applied to multidimensional lists.
609610
{
610611
threeDimensionalMatrix[[[?]!]]!
611612
}
613+
```
612614

613-
Any element without a nullability designator will inherit its nullability from the schema definition, exactly the same as non-list fields do. The number of dimensions indicated by
615+
Any element without a nullability designator will inherit its nullability from the
616+
schema definition, exactly the same as non-list fields do. When designating
617+
nullability for list fields, query authors can either use a single designator (`!` or `?`)
618+
to designate the nullability of the entire field, or they can use the list element
619+
nullability syntax displayed above. The number of dimensions indicated by
614620
list element nullability syntax is required to match the number of dimensions of the field.
615621
Anything else results in a query validation error.
616622

0 commit comments

Comments
 (0)