Skip to content

Commit

Permalink
clarify null behavior of if
Browse files Browse the repository at this point in the history
  • Loading branch information
robrichard committed Aug 31, 2023
1 parent a154bda commit 67689c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,7 @@ fragment someFragment on User {

- `if: Boolean! = true` - When `true`, fragment _should_ be deferred. When
`false`, fragment will not be deferred and data will be included in the
initial response. If omitted, defaults to `true`.
initial response. Defaults to `true` when omitted or null.
- `label: String` - May be used by GraphQL clients to identify the data from
responses and associate it with the corresponding defer directive. If
provided, the GraphQL Server must add it to the corresponding payload. `label`
Expand Down Expand Up @@ -2241,7 +2241,7 @@ query myQuery($shouldStream: Boolean) {

- `if: Boolean! = true` - When `true`, field _should_ be streamed. When `false`,
the field will not be streamed and all list items will be included in the
initial response. If omitted, defaults to `true`.
initial response. Defaults to `true` when omitted or null.
- `label: String` - May be used by GraphQL clients to identify the data from
responses and associate it with the corresponding stream directive. If
provided, the GraphQL Server must add it to the corresponding payload. `label`
Expand Down
37 changes: 19 additions & 18 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ asyncRecord, visitedFragments, deferredGroupedFieldsList):
- If {selection} is a {FragmentSpread}:
- Let {fragmentSpreadName} be the name of {selection}.
- If {fragmentSpreadName} provides the directive `@defer` and its {if}
argument is {true} or is a variable in {variableValues} with the value
{true}:
argument is not {false} and is not a variable in {variableValues} with the
value {false}:
- Let {deferDirective} be that directive.
- If {deferDirective} is not defined:
- If {fragmentSpreadName} is in {visitedFragments}, continue with the next
Expand Down Expand Up @@ -667,19 +667,20 @@ asyncRecord, visitedFragments, deferredGroupedFieldsList):
fragmentType)} is false, continue with the next {selection} in
{selectionSet}.
- Let {fragmentSelectionSet} be the top-level selection set of {selection}.
- If {InlineFragment} provides the directive `@defer`, let {deferDirective}
be that directive.
- If {deferDirective}'s {if} argument is {true} or is a variable in
{variableValues} with the value {true}:
- Let {label} be the value or the variable to {deferDirective}'s {label}
argument.
- Let {deferredGroupedFields} be the result of calling
{CollectFields(objectType, objectValue, fragmentSelectionSet,
variableValues, path, asyncRecord, visitedFragments,
deferredGroupedFieldsList)}.
- Append a record containing {label} and {deferredGroupedFields} to
{deferredGroupedFieldsList}.
- Continue with the next {selection} in {selectionSet}.
- If {InlineFragment} provides the directive `@defer` and its {if} argument
is not {false} and is not a variable in {variableValues} with the value
{false}:
- Let {deferDirective} be that directive.
- If {deferDirective} is defined:
- Let {label} be the value or the variable to {deferDirective}'s {label}
argument.
- Let {deferredGroupedFields} be the result of calling
{CollectFields(objectType, objectValue, fragmentSelectionSet,
variableValues, path, asyncRecord, visitedFragments,
deferredGroupedFieldsList)}.
- Append a record containing {label} and {deferredGroupedFields} to
{deferredGroupedFieldsList}.
- Continue with the next {selection} in {selectionSet}.
- Let {fragmentGroupedFieldSet} be the result of calling
{CollectFields(objectType, objectValue, fragmentSelectionSet,
variableValues, path, asyncRecord, visitedFragments,
Expand Down Expand Up @@ -944,9 +945,9 @@ subsequentPayloads, asyncRecord):
- If {result} is an iterator:
- Let {field} be the first entry in {fields}.
- Let {innerType} be the inner type of {fieldType}.
- If {field} provides the directive `@stream` and its {if} argument is
{true} or is a variable in {variableValues} with the value {true} and
{innerType} is the outermost return type of the list type defined for
- If {field} provides the directive `@stream` and its {if} argument is not
{false} and is not a variable in {variableValues} with the value {false}
and {innerType} is the outermost return type of the list type defined for
{field}:
- Let {streamDirective} be that directive.
- Let {initialCount} be the value or variable provided to
Expand Down

0 comments on commit 67689c5

Please sign in to comment.