Skip to content

Commit 3e74250

Browse files
committed
Raise a field error if defer/stream encountered during subscription execution
1 parent 02d4676 commit 3e74250

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

spec/Section 6 -- Execution.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,28 +329,15 @@ MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
329329

330330
ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
331331

332-
- Let {subsequentPayloads} be an empty list.
333332
- Let {subscriptionType} be the root Subscription type in {schema}.
334333
- Assert: {subscriptionType} is an Object type.
335334
- Let {selectionSet} be the top level Selection Set in {subscription}.
336335
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
337-
subscriptionType, initialValue, variableValues, subsequentPayloads)}
338-
_normally_ (allowing parallelization).
336+
subscriptionType, initialValue, variableValues)} _normally_ (allowing
337+
parallelization).
339338
- Let {errors} be the list of all _field error_ raised while executing the
340339
selection set.
341-
- If {subsequentPayloads} is empty:
342-
- Return an unordered map containing {data} and {errors}.
343-
- If {subsequentPayloads} is not empty:
344-
- Let {initialResponse} be an unordered map containing {data}, {errors}, and
345-
an entry named {hasNext} with the value {true}.
346-
- Let {iterator} be the result of running
347-
{YieldSubsequentPayloads(initialResponse, subsequentPayloads)}.
348-
- For each {payload} yielded by {iterator}:
349-
- If a termination signal is received:
350-
- Send a termination signal to {iterator}.
351-
- Return.
352-
- Otherwise:
353-
- Yield {payload}.
340+
- Return an unordered map containing {data} and {errors}.
354341

355342
Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
356343
{ExecuteQuery()} since this is how each event result is produced.
@@ -691,6 +678,8 @@ visitedFragments, deferredGroupedFieldsList):
691678
argument is not {false} and is not a variable in {variableValues} with the
692679
value {false}:
693680
- Let {deferDirective} be that directive.
681+
- If this execution is for a subscription operation, raise a _field
682+
error_.
694683
- If {deferDirective} is not defined:
695684
- If {fragmentSpreadName} is in {visitedFragments}, continue with the next
696685
{selection} in {selectionSet}.
@@ -731,6 +720,8 @@ visitedFragments, deferredGroupedFieldsList):
731720
is not {false} and is not a variable in {variableValues} with the value
732721
{false}:
733722
- Let {deferDirective} be that directive.
723+
- If this execution is for a subscription operation, raise a _field
724+
error_.
734725
- If {deferDirective} is defined:
735726
- Let {label} be the value or the variable to {deferDirective}'s {label}
736727
argument.
@@ -998,6 +989,7 @@ subsequentPayloads, asyncRecord):
998989
{innerType} is the outermost return type of the list type defined for
999990
{field}:
1000991
- Let {streamDirective} be that directive.
992+
- If this execution is for a subscription operation, raise a _field error_.
1001993
- Let {initialCount} be the value or variable provided to
1002994
{streamDirective}'s {initialCount} argument.
1003995
- If {initialCount} is less than zero, raise a _field error_.

0 commit comments

Comments
 (0)