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