@@ -134,12 +134,8 @@ ExecuteQuery(query, schema, variableValues, initialValue):
134
134
- Let {queryType} be the root Query type in {schema}.
135
135
- Assert: {queryType} is an Object type.
136
136
- Let {selectionSet} be the top level selection set in {query}.
137
- - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
138
- queryType, initialValue, variableValues)} _ normally_ (allowing
139
- parallelization).
140
- - Let {errors} be the list of all _ field error_ raised while executing the
141
- selection set.
142
- - Return an unordered map containing {data} and {errors}.
137
+ - Return {ExecuteRootSelectionSet(variableValues, initialValue, queryType,
138
+ selectionSet)}.
143
139
144
140
### Mutation
145
141
@@ -156,11 +152,8 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
156
152
- Let {mutationType} be the root Mutation type in {schema}.
157
153
- Assert: {mutationType} is an Object type.
158
154
- Let {selectionSet} be the top level selection set in {mutation}.
159
- - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
160
- mutationType, initialValue, variableValues)} _ serially_ .
161
- - Let {errors} be the list of all _ field error_ raised while executing the
162
- selection set.
163
- - Return an unordered map containing {data} and {errors}.
155
+ - Return {ExecuteRootSelectionSet(variableValues, initialValue, mutationType,
156
+ selectionSet, true)}.
164
157
165
158
### Subscription
166
159
@@ -304,12 +297,8 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
304
297
- Let {subscriptionType} be the root Subscription type in {schema}.
305
298
- Assert: {subscriptionType} is an Object type.
306
299
- Let {selectionSet} be the top level selection set in {subscription}.
307
- - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
308
- subscriptionType, initialValue, variableValues)} _ normally_ (allowing
309
- parallelization).
310
- - Let {errors} be the list of all _ field error_ raised while executing the
311
- selection set.
312
- - Return an unordered map containing {data} and {errors}.
300
+ - Return {ExecuteRootSelectionSet(variableValues, initialValue,
301
+ subscriptionType, selectionSet)}.
313
302
314
303
Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
315
304
{ExecuteQuery()} since this is how each event result is produced.
@@ -325,6 +314,27 @@ Unsubscribe(responseStream):
325
314
326
315
- Cancel {responseStream}.
327
316
317
+ ## Executing the Root Selection Set
318
+
319
+ To execute the root selection set, the object value being evaluated and the
320
+ object type need to be known, as well as whether it must be executed serially,
321
+ or may be executed in parallel.
322
+
323
+ Executing the root selection set works similarly for queries (parallel),
324
+ mutations (serial), and subscriptions (where it is executed for each event in
325
+ the underlying Source Stream).
326
+
327
+ ExecuteRootSelectionSet(variableValues, initialValue, objectType, selectionSet,
328
+ serial):
329
+
330
+ - If {serial} is not provided, initialize it to {false}.
331
+ - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
332
+ objectType, initialValue, variableValues)} _ serially_ if {serial} is {true},
333
+ _ normally_ (allowing parallelization) otherwise.
334
+ - Let {errors} be the list of all _ field error_ raised while executing the
335
+ selection set.
336
+ - Return an unordered map containing {data} and {errors}.
337
+
328
338
## Executing Selection Sets
329
339
330
340
To execute a _ selection set_ , the object value being evaluated and the object
0 commit comments