@@ -8,43 +8,49 @@ A GraphQL service generates a response from a request via execution.
8
8
- {document}: A {Document} which must contain GraphQL {OperationDefinition} and
9
9
may contain {FragmentDefinition}.
10
10
- {operationName} (optional): The name of the Operation in the Document to
11
- execute .
11
+ process .
12
12
- {variableValues} (optional): Values for any Variables defined by the
13
13
Operation.
14
14
- {initialValue} (optional): An initial value corresponding to the root type
15
15
being executed. Conceptually, an initial value represents the "universe" of
16
16
data available via a GraphQL Service. It is common for a GraphQL Service to
17
17
always use the same initial value for every request.
18
18
19
- Given this information, the result of {ExecuteRequest (schema, document,
19
+ Given this information, the result of {ProcessRequest (schema, document,
20
20
operationName, variableValues, initialValue)} produces the response, to be
21
21
formatted according to the Response section below.
22
22
23
+ :: Formally, _ execution_ starts when executing the root selection set in
24
+ {ExecuteRootSelectionSet()}. For convenience, this section also contains
25
+ preliminary steps required for execution such as coercing variables or getting a
26
+ source event stream.
27
+
23
28
Note: GraphQL requests do not require any specific serialization format or
24
29
transport mechanism. Message serialization and transport mechanisms should be
25
30
chosen by the implementing service.
26
31
27
- ## Executing Requests
32
+ ## Processing Requests
28
33
29
- To execute a request, the executor must have a parsed {Document} and a selected
34
+ To process a request, the executor must have a parsed {Document} and a selected
30
35
operation name to run if the document defines multiple operations, otherwise the
31
36
document is expected to only contain a single operation. The result of the
32
- request is determined by the result of executing this operation according to the
33
- "Executing Operations” section below.
37
+ request is determined by the result of processing this operation according to
38
+ the "Processing Operations” section below.
34
39
35
- ExecuteRequest (schema, document, operationName, variableValues, initialValue):
40
+ ProcessRequest (schema, document, operationName, variableValues, initialValue):
36
41
37
42
- Let {operation} be the result of {GetOperation(document, operationName)}.
38
43
- Let {coercedVariableValues} be the result of {CoerceVariableValues(schema,
39
44
operation, variableValues)}.
40
45
- If {operation} is a query operation:
41
- - Return {ExecuteQuery (operation, schema, coercedVariableValues,
46
+ - Return {ProcessQuery (operation, schema, coercedVariableValues,
42
47
initialValue)}.
43
48
- Otherwise if {operation} is a mutation operation:
44
- - Return {ExecuteMutation (operation, schema, coercedVariableValues,
49
+ - Return {ProcessMutation (operation, schema, coercedVariableValues,
45
50
initialValue)}.
46
51
- Otherwise if {operation} is a subscription operation:
47
- - Return {Subscribe(operation, schema, coercedVariableValues, initialValue)}.
52
+ - Return {ProcessSubscription(operation, schema, coercedVariableValues,
53
+ initialValue)}.
48
54
49
55
GetOperation(document, operationName):
50
56
@@ -60,14 +66,14 @@ GetOperation(document, operationName):
60
66
### Validating Requests
61
67
62
68
As explained in the Validation section, only requests which pass all validation
63
- rules should be executed . If validation errors are known, they should be
64
- reported in the list of "errors" in the response and the request must fail
65
- without execution .
69
+ rules should be process . If validation errors are known, they should be reported
70
+ in the list of "errors" in the response and the request must fail without
71
+ processing .
66
72
67
73
Typically validation is performed in the context of a request immediately before
68
- execution , however a GraphQL service may execute a request without immediately
74
+ processing , however a GraphQL service may process a request without immediately
69
75
validating it if that exact same request is known to have been validated before.
70
- A GraphQL service should only execute requests which _ at some point_ were known
76
+ A GraphQL service should only process requests which _ at some point_ were known
71
77
to be free of any validation errors, and have since not changed.
72
78
73
79
For example: the request may be validated during development, provided it does
@@ -114,7 +120,7 @@ CoerceVariableValues(schema, operation, variableValues):
114
120
115
121
Note: This algorithm is very similar to {CoerceArgumentValues()}.
116
122
117
- ## Executing Operations
123
+ ## Processing Operations
118
124
119
125
The type system, as described in the "Type System" section of the spec, must
120
126
provide a query root operation type. If mutations or subscriptions are
@@ -124,12 +130,12 @@ respectively.
124
130
### Query
125
131
126
132
If the operation is a query, the result of the operation is the result of
127
- executing the operation’s top level _ selection set_ with the query root
128
- operation type.
133
+ executing the operation’s root _ selection set_ with the query root operation
134
+ type.
129
135
130
- An initial value may be provided when executing a query operation.
136
+ An initial value may be provided when processing a query operation.
131
137
132
- ExecuteQuery (query, schema, variableValues, initialValue):
138
+ ProcessQuery (query, schema, variableValues, initialValue):
133
139
134
140
- Let {queryType} be the root Query type in {schema}.
135
141
- Assert: {queryType} is an Object type.
@@ -140,14 +146,14 @@ ExecuteQuery(query, schema, variableValues, initialValue):
140
146
### Mutation
141
147
142
148
If the operation is a mutation, the result of the operation is the result of
143
- executing the operation’s top level _ selection set_ on the mutation root object
144
- type. This selection set should be executed serially.
149
+ executing the operation’s root _ selection set_ on the mutation root object type.
150
+ This selection set should be executed serially.
145
151
146
152
It is expected that the top level fields in a mutation operation perform
147
153
side-effects on the underlying data system. Serial execution of the provided
148
154
mutations ensures against race conditions during these side-effects.
149
155
150
- ExecuteMutation (mutation, schema, variableValues, initialValue):
156
+ ProcessMutation (mutation, schema, variableValues, initialValue):
151
157
152
158
- Let {mutationType} be the root Mutation type in {schema}.
153
159
- Assert: {mutationType} is an Object type.
@@ -159,12 +165,13 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
159
165
160
166
If the operation is a subscription, the result is an _ event stream_ called the
161
167
_ response stream_ where each event in the event stream is the result of
162
- executing the operation for each new event on an underlying _ source stream_ .
168
+ executing the operation ’s root _ selection set_ for each new event on an
169
+ underlying _ source stream_ .
163
170
164
- Executing a subscription operation creates a persistent function on the service
171
+ Processing a subscription operation creates a persistent function on the service
165
172
that maps an underlying _ source stream_ to a returned _ response stream_ .
166
173
167
- Subscribe (subscription, schema, variableValues, initialValue):
174
+ ProcessSubscription (subscription, schema, variableValues, initialValue):
168
175
169
176
- Let {sourceStream} be the result of running
170
177
{CreateSourceEventStream(subscription, schema, variableValues, initialValue)}.
@@ -173,8 +180,8 @@ Subscribe(subscription, schema, variableValues, initialValue):
173
180
variableValues)}.
174
181
- Return {responseStream}.
175
182
176
- Note: In a large-scale subscription system, the {Subscribe ()} and
177
- {ExecuteSubscriptionEvent ()} algorithms may be run on separate services to
183
+ Note: In a large-scale subscription system, the {ProcessSubscription ()} and
184
+ {ProcessSubscriptionEvent ()} algorithms may be run on separate services to
178
185
maintain predictable scaling properties. See the section below on Supporting
179
186
Subscriptions at Scale.
180
187
@@ -295,7 +302,7 @@ MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
295
302
- Let {responseStream} be a new _ event stream_ .
296
303
- When {sourceStream} emits {sourceValue}:
297
304
- Let {response} be the result of running
298
- {ExecuteSubscriptionEvent (subscription, schema, variableValues,
305
+ {ProcessSubscriptionEvent (subscription, schema, variableValues,
299
306
sourceValue)}.
300
307
- If internal {error} was raised:
301
308
- Cancel {sourceStream}.
@@ -310,21 +317,21 @@ MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
310
317
- Complete {responseStream} normally.
311
318
- Return {responseStream}.
312
319
313
- Note: Since {ExecuteSubscriptionEvent ()} handles all _ field error_ , and _ request
320
+ Note: Since {ProcessSubscriptionEvent ()} handles all _ field error_ , and _ request
314
321
error_ only occur during {CreateSourceEventStream()}, the only remaining error
315
- condition handled from {ExecuteSubscriptionEvent ()} are internal exceptional
322
+ condition handled from {ProcessSubscriptionEvent ()} are internal exceptional
316
323
errors not described by this specification.
317
324
318
- ExecuteSubscriptionEvent (subscription, schema, variableValues, initialValue):
325
+ ProcessSubscriptionEvent (subscription, schema, variableValues, initialValue):
319
326
320
327
- Let {subscriptionType} be the root Subscription type in {schema}.
321
328
- Assert: {subscriptionType} is an Object type.
322
329
- Let {selectionSet} be the top level selection set in {subscription}.
323
330
- Return {ExecuteRootSelectionSet(variableValues, initialValue,
324
331
subscriptionType, selectionSet)}.
325
332
326
- Note: The {ExecuteSubscriptionEvent ()} algorithm is intentionally similar to
327
- {ExecuteQuery ()} since this is how each event result is produced.
333
+ Note: The {ProcessSubscriptionEvent ()} algorithm is intentionally similar to
334
+ {ProcessQuery ()} since this is how each event result is produced.
328
335
329
336
#### Unsubscribe
330
337
@@ -534,7 +541,7 @@ A valid GraphQL executor can resolve the four fields in whatever order it chose
534
541
(however of course ` birthday ` must be resolved before ` month ` , and ` address `
535
542
before ` street ` ).
536
543
537
- When executing a mutation, the selections in the top most selection set will be
544
+ When processing a mutation, the selections in the top most selection set will be
538
545
executed in serial order, starting with the first appearing field textually.
539
546
540
547
When executing a grouped field set serially, the executor must consider each
@@ -679,8 +686,8 @@ CoerceArgumentValues(objectType, field, variableValues):
679
686
- Return {coercedValues}.
680
687
681
688
Note: Variable values are not coerced because they are expected to be coerced
682
- before executing the operation in {CoerceVariableValues()}, and valid operations
683
- must only allow usage of variables of appropriate types.
689
+ before processing the operation in {CoerceVariableValues()}, and valid
690
+ operations must only allow usage of variables of appropriate types.
684
691
685
692
### Value Resolution
686
693
0 commit comments