Skip to content

Commit c2d1693

Browse files
committed
Clearer @stream with initialCount
1 parent e4be72f commit c2d1693

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

spec/Section 6 -- Execution.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,16 +417,30 @@ ExecuteSelectionSet(selectionSet, objectType, objectValue, variableValues):
417417
- Let {fieldType} be the return type defined for the field {fieldName} of
418418
{objectType}.
419419
- If {fieldType} is defined:
420-
- If {fieldType} is a list type and {field} provides the directive
421-
`@stream`, let {streamDirective} be that directive.
422-
- TODO: `@stream(if:)`
423-
- Add {fieldDetails} to {streams}.
424-
- Else if every entry in {fieldDetails} has {isDeferred} set to {true}:
420+
- If every entry in {fieldDetails} has {isDeferred} set to {true}:
425421
- Add {fieldDetails} to {deferred}.
426422
- Else:
427423
- Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
428424
fieldDetails, variableValues)}.
429-
- Set {responseValue} as the value for {responseKey} in {resultMap}.
425+
- If {responseValue} is not null and {fieldType} is a list type and
426+
{field} provides the directive `@stream`, let {streamDirective} be that
427+
directive. If {streamDirective}'s {if} argument is not {false} and is
428+
not a variable in {variableValues} with the value {false}:
429+
- If {streamDirective}'s {initialCount} argument is a variable:
430+
- Let {initialCount} be the value of that variable in
431+
{variableValues}.
432+
- Else
433+
- Let {initialCount} be the value of {streamDirective}'s
434+
{initialCount} argument.
435+
- If {initialCount} is {null}, not provided, or less than {0} then let
436+
{initialCount} be {0}.
437+
- Let {initialValues} be the first {initialCount} entires in
438+
{responesValue}, and {remainingValues} be the remainder.
439+
- Set {initialValues} as the value for {responseKey} in {resultMap}.
440+
- If there are (or may be) values in {remainingValues}:
441+
- TODO: add {remainingValues} to {streams} via some mechanism...
442+
- Else:
443+
- Set {responseValue} as the value for {responseKey} in {resultMap}.
430444
- Let {pendings} be an empty list.
431445
- If {deferred} is not empty:
432446
- Add a single entry to {pendings}.

0 commit comments

Comments
 (0)