@@ -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
@@ -301,12 +294,8 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
301
294
- Let {subscriptionType} be the root Subscription type in {schema}.
302
295
- Assert: {subscriptionType} is an Object type.
303
296
- Let {selectionSet} be the top level Selection Set in {subscription}.
304
- - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
305
- subscriptionType, initialValue, variableValues)} _ normally_ (allowing
306
- parallelization).
307
- - Let {errors} be the list of all _ field error_ raised while executing the
308
- selection set.
309
- - Return an unordered map containing {data} and {errors}.
297
+ - Return {ExecuteRootSelectionSet(variableValues, initialValue,
298
+ subscriptionType, selectionSet)}.
310
299
311
300
Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
312
301
{ExecuteQuery()} since this is how each event result is produced.
@@ -322,6 +311,27 @@ Unsubscribe(responseStream):
322
311
323
312
- Cancel {responseStream}
324
313
314
+ ## Executing the Root Selection Set
315
+
316
+ To execute the root selection set, the object value being evaluated and the
317
+ object type need to be known, as well as whether it must be executed serially,
318
+ or may be executed in parallel.
319
+
320
+ Executing the root selection set works similarly for queries (parallel),
321
+ mutations (serial), and subscriptions (where it is executed for each event in
322
+ the underlying Source Stream).
323
+
324
+ ExecuteRootSelectionSet(variableValues, initialValue, objectType, selectionSet,
325
+ serial):
326
+
327
+ - If {serial} is not provided, initialize it to {false}.
328
+ - Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
329
+ objectType, initialValue, variableValues)} _ serially_ if {serial} is {true},
330
+ _ normally_ (allowing parallelization) otherwise.
331
+ - Let {errors} be the list of all _ field error_ raised while executing the
332
+ selection set.
333
+ - Return an unordered map containing {data} and {errors}.
334
+
325
335
## Executing Selection Sets
326
336
327
337
To execute a selection set, the object value being evaluated and the object type
0 commit comments