Skip to content

Commit

Permalink
Improve clarity for treating null for List values (#213)
Browse files Browse the repository at this point in the history
As mentioned in #83, we had left the treatment of input `null` by a List value ambiguous, while there is an intended behavior.

Because of the existing language, it's easy to misinterpret providing `null` to `[String]` as the value `[null]`, while the correct interpretating would be `null`.
  • Loading branch information
leebyron authored Sep 19, 2016
1 parent ba1bbe5 commit 910b694
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,16 @@ implementation.
When expected as an input, list values are accepted only when each item in the
list can be accepted by the list's item type.

If the value passed as an input to a list type is *not* as list, it should be
coerced as though the input was a list of size one, where the value passed is
the only item in the list. This is to allow inputs that accept a "var args"
to declare their input type as a list; if only one argument is passed (a common
case), the client can just pass that value rather than constructing the list.
If the value passed as an input to a list type is *not* a list and not the
{null} value, it should be coerced as though the input was a list of size one,
where the value passed is the only item in the list. This is to allow inputs
that accept a "var args" to declare their input type as a list; if only one
argument is passed (a common case), the client can just pass that value rather
than constructing the list.

Note that when a {null} value is provided via a runtime variable value for a
list type that it is interpretted as no list being provided, and not a list of
size one with the value {null}.


### Non-Null
Expand Down Expand Up @@ -878,7 +883,7 @@ query withNullableVariable($var: String) {
}
```

#### Non-Null type validation
**Non-Null type validation**

1. A Non-Null type must not wrap another Non-Null type.

Expand Down

0 comments on commit 910b694

Please sign in to comment.