@@ -690,22 +690,33 @@ case), the client can just pass that value rather than constructing the list.
690
690
691
691
By default, all types in GraphQL are nullable; the {null} value is a valid
692
692
response for all of the above types. To declare a type that disallows null,
693
- the GraphQL Non-Null type can be used. This type declares an underlying type,
694
- and this type acts identically to that underlying type, with the exception
693
+ the GraphQL Non-Null type can be used. This type wraps an underlying type,
694
+ and this type acts identically to that wrapped type, with the exception
695
695
that ` null ` is not a valid response for the wrapping type. A trailing
696
696
exclamation mark is used to denote a field that uses a Non-Null type like this:
697
697
` name: String! ` .
698
698
699
699
** Result Coercion**
700
700
701
- In all of the above result coercion, ` null ` was considered a valid value.
702
- To coerce the result of a Non Null type, the result coercion of the
703
- underlying type should be performed. If that result was not ` null ` , then the
704
- result of coercing the Non Null type is that result. If that result was ` null ` ,
705
- then an error should be raised.
701
+ In all of the above result coercion, { null} was considered a valid value.
702
+ To coerce the result of a Non Null type, the coercion of the wrapped type
703
+ should be performed. If that result was not { null} , then the result of coercing
704
+ the Non Null type is that result. If that result was { null}, then a field error
705
+ must be raised.
706
706
707
707
** Input Coercion**
708
708
709
+ If the argument of a Non Null type is not provided, a query error must
710
+ be raised.
711
+
712
+ If an argument of a Non Null type is provided with a literal value, it is
713
+ coerced using the input coercion for the wrapped type.
714
+
715
+ If the argument of a Non Null is provided with a variable, a query error must be
716
+ raised if the runtime provided value is not provided or is {null} in the
717
+ provided representation (usually JSON). Otherwise, the coerced value is the
718
+ result of using the input coercion for the wrapped type.
719
+
709
720
Note that ` null ` is not a value in GraphQL, so a query cannot look like:
710
721
711
722
``` !graphql
@@ -714,8 +725,8 @@ Note that `null` is not a value in GraphQL, so a query cannot look like:
714
725
}
715
726
```
716
727
717
- to indicate that the argument is null. Instead, an argument would be null only
718
- if it is omitted:
728
+ to indicate that the argument is { null} . Instead, an argument would be { null}
729
+ only if it is omitted:
719
730
720
731
``` graphql
721
732
{
@@ -732,14 +743,6 @@ query withNullableVariable($var: String) {
732
743
}
733
744
```
734
745
735
- Hence, if the value for a Non Null type is hard-coded in the query, it is always
736
- coerced using the input coercion for the wrapped type.
737
-
738
- When a Non Null input has its value set using a variable, a query
739
- error must be raised if the provided value is ` null ` -like in the
740
- provided representation, or if the provided value is omitted.
741
- Otherwise, the coerced value is the result of running the wrapped
742
- type's input coercion on the provided value.
743
746
744
747
## Directives
745
748
0 commit comments