@@ -131,12 +131,8 @@ ExecuteQuery(query, schema, variableValues, initialValue):
131131- Let {queryType} be the root Query type in {schema}.
132132- Assert: {queryType} is an Object type.
133133- 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)}.
140136
141137### Mutation
142138
@@ -153,11 +149,8 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
153149- Let {mutationType} be the root Mutation type in {schema}.
154150- Assert: {mutationType} is an Object type.
155151- 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)}.
161154
162155### Subscription
163156
@@ -300,12 +293,8 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
300293- Let {subscriptionType} be the root Subscription type in {schema}.
301294- Assert: {subscriptionType} is an Object type.
302295- 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)}.
309298
310299Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
311300{ExecuteQuery()} since this is how each event result is produced.
@@ -321,6 +310,27 @@ Unsubscribe(responseStream):
321310
322311- Cancel {responseStream}
323312
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+
324334## Executing Selection Sets
325335
326336To execute a selection set, the object value being evaluated and the object type
0 commit comments