Skip to content

Commit cb29f6e

Browse files
committed
Default value coercion rules
1 parent d388f13 commit cb29f6e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spec/Section 6 -- Execution.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ CoerceVariableValues(schema, operation, variableValues):
8989
* Let {value} be the value provided in {variableValues} for the
9090
name {variableName}.
9191
* If {hasValue} is not {true} and {defaultValue} exists (including {null}):
92+
* If {defaultValue} cannot be coerced according to the input coercion
93+
rules of {variableType}, throw a query error.
94+
* Let {coercedDefaultValue} be the result of coercing {defaultValue} according to the
95+
input coercion rules of {variableType}.
9296
* Add an entry to {coercedValues} named {variableName} with the
93-
value {defaultValue}.
97+
value {coercedDefaultValue}.
9498
* Otherwise if {variableType} is a Non-Nullable type, and either {hasValue}
9599
is not {true} or {value} is {null}, throw a query error.
96100
* Otherwise if {hasValue} is true:
@@ -586,8 +590,12 @@ CoerceArgumentValues(objectType, field, variableValues):
586590
name {variableName}.
587591
* Otherwise, let {value} be {argumentValue}.
588592
* If {hasValue} is not {true} and {defaultValue} exists (including {null}):
593+
* If {defaultValue} cannot be coerced according to the input coercion
594+
rules of {variableType}, throw a query error.
595+
* Let {coercedDefaultValue} be the result of coercing {defaultValue} according to the
596+
input coercion rules of {variableType}.
589597
* Add an entry to {coercedValues} named {argumentName} with the
590-
value {defaultValue}.
598+
value {coercedDefaultValue}.
591599
* Otherwise if {argumentType} is a Non-Nullable type, and either {hasValue}
592600
is not {true} or {value} is {null}, throw a field error.
593601
* Otherwise if {hasValue} is true:

0 commit comments

Comments
 (0)