Skip to content

Commit d584a21

Browse files
committed
language updated
1 parent fdc8b52 commit d584a21

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
@@ -529,16 +529,17 @@ NullabilityModifier :
529529
Fields can have their nullability designated with either a `!` to indicate that a
530530
field should be `Non-Nullable` or a `?` to indicate that a field should be
531531
`Nullable`. These designators override the nullability set on a field by the schema
532-
for the operation where they're being used. For example, a field marked with `!` in
533-
a query will be treated identically to a field marked with `!` in the schema for the
534-
purposes of validation and execution.
532+
for the operation where they're being used. In addition to being `Non-Nullable`,
533+
if a field marked with `!` resolves to `null`, it propagates to the nearest parent
534+
field marked with a `?` or to `data` if one does not exist. An error is added to
535+
the `errors` array identical to if the field had been `Non-Nullable` in the schema.
535536

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

539540
```graphql example
540541
{
541-
user(id: 4) {
542+
user(id: 4)? {
542543
id
543544
name!
544545
}
@@ -608,8 +609,13 @@ applied to multidimensional lists.
608609
{
609610
threeDimensionalMatrix[[[?]!]]!
610611
}
612+
```
611613

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

0 commit comments

Comments
 (0)