Skip to content

Commit cbd137f

Browse files
committed
Fix input coercion section for non-null types.
Resolves #15.
1 parent fd7410b commit cbd137f

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

Section 3 -- Type System.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,31 @@ then an error should be raised.
711711

712712
**Input Coercion**
713713

714-
When accepted as an input, each item in the list should be coerced as per
715-
the input coercion of the item type.
714+
Note that `null` is not a valid keyword in GraphQL, so a query cannot look like:
716715

717-
If the value passed as an input to a list type is *not* as list, it should be
718-
coerced as though the input was a list of size one, where the value passed is
719-
the only item in the list. This is to allow inputs that accept a "var args"
720-
to declare their input type as a list; if only one argument is passed (a common
721-
case), the client can just pass that value rather than constructing the list.
716+
```!graphql
717+
{
718+
field(arg: null)
719+
}
720+
```
721+
722+
to indicate that the argument is null. Instead, an argument would be null only
723+
if it is passed a variable that is then not set:
724+
725+
```graphql
726+
{
727+
field(arg: $var)
728+
}
729+
```
730+
731+
Hence, if the value for a non-null is hard-coded in the query, it is always
732+
coerced using the input coercion for the wrapped type.
722733

734+
When a non-null input has its value set using a variable, the coerced value
735+
should be `null` if the provided value is `null`-like in the provided
736+
representation, or if the provided value is omitted. Otherwise, the coerced
737+
value is the result of running the wrapped type's input coercion on the provided
738+
value.
723739

724740
## Directives
725741

0 commit comments

Comments
 (0)