Skip to content

Commit 16978d4

Browse files
committed
Remove CoerceVariableValues
1 parent f4f53ed commit 16978d4

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

spec/Section 6 -- Execution.md

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ request is determined by the result of executing this operation according to the
2828
ExecuteRequest(schema, document, operationName, variableValues, initialValue):
2929

3030
* Let {operation} be the result of {GetOperation(document, operationName)}.
31-
* Let {coercedVariableValues} be the result of {CoerceVariableValues(schema, operation, variableValues)}.
3231
* If {operation} is a query operation:
33-
* Return {ExecuteQuery(operation, schema, coercedVariableValues, initialValue)}.
32+
* Return {ExecuteQuery(operation, schema, variableValues, initialValue)}.
3433
* Otherwise if {operation} is a mutation operation:
35-
* Return {ExecuteMutation(operation, schema, coercedVariableValues, initialValue)}.
34+
* Return {ExecuteMutation(operation, schema, variableValues, initialValue)}.
3635
* Otherwise if {operation} is a subscription operation:
37-
* Return {Subscribe(operation, schema, coercedVariableValues, initialValue)}.
36+
* Return {Subscribe(operation, schema, variableValues, initialValue)}.
3837

3938
GetOperation(document, operationName):
4039

@@ -67,48 +66,6 @@ not later change, or a service may validate a request once and memoize the
6766
result to avoid validating the same request again in the future.
6867

6968

70-
### Coercing Variable Values
71-
72-
If the operation has defined any variables, then the values for
73-
those variables need to be coerced using the input coercion rules
74-
of variable's declared type. If a query error is encountered during
75-
input coercion of variable values, then the operation fails without
76-
execution.
77-
78-
CoerceVariableValues(schema, operation, variableValues):
79-
80-
* Let {coercedValues} be an empty unordered Map.
81-
* Let {variableDefinitions} be the variables defined by {operation}.
82-
* For each {variableDefinition} in {variableDefinitions}:
83-
* Let {variableName} be the name of {variableDefinition}.
84-
* Let {variableType} be the expected type of {variableDefinition}.
85-
* Assert: {IsInputType(variableType)} must be {true}.
86-
* Let {defaultValue} be the default value for {variableDefinition}.
87-
* Let {hasValue} be {true} if {variableValues} provides a value for the
88-
name {variableName}.
89-
* Let {value} be the value provided in {variableValues} for the
90-
name {variableName}.
91-
* If {hasValue} is not {true} and {defaultValue} exists (including {null}):
92-
* Add an entry to {coercedValues} named {variableName} with the
93-
value {defaultValue}.
94-
* Otherwise if {variableType} is a Non-Nullable type, and either {hasValue}
95-
is not {true} or {value} is {null}, throw a query error.
96-
* Otherwise if {hasValue} is true:
97-
* If {value} is {null}:
98-
* Add an entry to {coercedValues} named {variableName} with the
99-
value {null}.
100-
* Otherwise:
101-
* If {value} cannot be coerced according to the input coercion
102-
rules of {variableType}, throw a query error.
103-
* Let {coercedValue} be the result of coercing {value} according to the
104-
input coercion rules of {variableType}.
105-
* Add an entry to {coercedValues} named {variableName} with the
106-
value {coercedValue}.
107-
* Return {coercedValues}.
108-
109-
Note: This algorithm is very similar to {CoerceArgumentValues()}.
110-
111-
11269
## Executing Operations
11370

11471
The type system, as described in the "Type System" section of the spec, must
@@ -591,9 +548,6 @@ CoerceArgumentValues(objectType, field, variableValues):
591548
* If {value} is {null}:
592549
* Add an entry to {coercedValues} named {argumentName} with the
593550
value {null}.
594-
* Otherwise, if {argumentValue} is a {Variable}:
595-
* Add an entry to {coercedValues} named {argumentName} with the
596-
value {value}.
597551
* Otherwise:
598552
* If {value} cannot be coerced according to the input coercion
599553
rules of {variableType}, throw a field error.
@@ -603,10 +557,6 @@ CoerceArgumentValues(objectType, field, variableValues):
603557
value {coercedValue}.
604558
* Return {coercedValues}.
605559

606-
Note: Variable values are not coerced because they are expected to be coerced
607-
before executing the operation in {CoerceVariableValues()}, and valid queries
608-
must only allow usage of variables of appropriate types.
609-
610560

611561
### Value Resolution
612562

0 commit comments

Comments
 (0)