Skip to content

Commit

Permalink
Default value coercion rules
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 13, 2020
1 parent d388f13 commit cb29f6e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ CoerceVariableValues(schema, operation, variableValues):
* Let {value} be the value provided in {variableValues} for the
name {variableName}.
* If {hasValue} is not {true} and {defaultValue} exists (including {null}):
* If {defaultValue} cannot be coerced according to the input coercion
rules of {variableType}, throw a query error.
* Let {coercedDefaultValue} be the result of coercing {defaultValue} according to the
input coercion rules of {variableType}.
* Add an entry to {coercedValues} named {variableName} with the
value {defaultValue}.
value {coercedDefaultValue}.
* Otherwise if {variableType} is a Non-Nullable type, and either {hasValue}
is not {true} or {value} is {null}, throw a query error.
* Otherwise if {hasValue} is true:
Expand Down Expand Up @@ -586,8 +590,12 @@ CoerceArgumentValues(objectType, field, variableValues):
name {variableName}.
* Otherwise, let {value} be {argumentValue}.
* If {hasValue} is not {true} and {defaultValue} exists (including {null}):
* If {defaultValue} cannot be coerced according to the input coercion
rules of {variableType}, throw a query error.
* Let {coercedDefaultValue} be the result of coercing {defaultValue} according to the
input coercion rules of {variableType}.
* Add an entry to {coercedValues} named {argumentName} with the
value {defaultValue}.
value {coercedDefaultValue}.
* Otherwise if {argumentType} is a Non-Nullable type, and either {hasValue}
is not {true} or {value} is {null}, throw a field error.
* Otherwise if {hasValue} is true:
Expand Down

0 comments on commit cb29f6e

Please sign in to comment.