@@ -1792,14 +1792,26 @@ CoerceListItemValue(itemValue, itemType):
1792
1792
1793
1793
- If {itemValue } is {null }, return {null }.
1794
1794
- Otherwise , if {itemValue } is a Variable :
1795
- - Let {runtimeValue } be the runtime value of that variable , or {null } if no
1796
- runtime value is provided .
1797
- - If {runtimeValue } is {null } and {itemType } is a non -null type , a _field
1795
+ - If the variable provides a runtime value :
1796
+ - Let {coercedItemValue } be the runtime value of the variable .
1797
+ - Otherwise , if the variable definition provides a default value :
1798
+ - Let {coercedItemValue } be this default value .
1799
+ - Otherwise :
1800
+ - Let {coercedItemValue } be {null }.
1801
+ - If {coercedItemValue } is {null } and {itemType } is a non -null type , a _field
1798
1802
error_ must be raised .
1799
- - Return {runtimeValue }.
1803
+ - Return {coercedItemValue }.
1800
1804
- Otherwise , return the result of coercing {itemValue } according to the input
1801
1805
coercion rules for {itemType }.
1802
1806
1807
+ Note : When a default value exists for a variable definition , the type of the
1808
+ variable is allowed to be nullable even if it is used in a non -nullable
1809
+ position , see
1810
+ [Allowing Optional Variables When Default Values Exist ](#sec-All-Variable-Usages-Are-Allowed.Allowing-Optional-Variables-When-Default-Values-Exist)
1811
+ in Validation. If the value for such a variable is explicitly {null} and is used
1812
+ as the value for a list item of non-nullable type then a _field error_ will be
1813
+ raised.
1814
+
1803
1815
Following are examples of input coercion with various list types and values :
1804
1816
1805
1817
| Expected Type | Literal Value | Variable Values | Coerced Value |
0 commit comments