@@ -1947,13 +1947,13 @@ GraphQL implementations that support the type system definition language must
1947
1947
provide the `@deprecated ` directive if representing deprecated portions of the
1948
1948
schema .
1949
1949
1950
- GraphQL services are not required to implement the `@defer ` and `@stream `
1951
- directives . If either or both of these directives are implemented , they must be
1952
- implemented according to this specification . GraphQL services that do not
1953
- support these directives must not make them available via introspection . The
1954
- [Directives Are Defined ](#sec-Directives-Are-Defined) validation rule will
1955
- prevent GraphQL Operations containing the `@defer` or `@stream` directive from
1956
- being executed by a GraphQL service that does not implement these directives .
1950
+ GraphQL implementations may provide the `@defer ` and / or `@stream ` directives . If
1951
+ either or both of these directives are provided , they must conform to the
1952
+ requirements defined in this specification .
1953
+
1954
+ Note : The [Directives Are Defined ](#sec-Directives-Are-Defined) validation rule
1955
+ ensures that GraphQL Operations containing the `@defer` or `@stream` directives
1956
+ cannot be executed by a GraphQL service that does not support them .
1957
1957
1958
1958
GraphQL implementations that support the type system definition language should
1959
1959
provide the `@specifiedBy` directive if representing custom scalar definitions.
@@ -2181,15 +2181,16 @@ directive @defer(
2181
2181
) on FRAGMENT_SPREAD | INLINE_FRAGMENT
2182
2182
```
2183
2183
2184
- The `@defer ` directive may be provided for fragment spreads and inline fragments
2185
- to inform the executor to delay the execution of the current fragment to
2186
- indicate deprioritization of the current fragment . A query with `@defer `
2187
- directive will cause the request to potentially return multiple responses , where
2188
- deferred data is delivered in subsequent responses . `@include ` and `@skip ` take
2189
- precedence over `@defer `.
2184
+ The `@defer ` directive may be provided on a fragment spread or inline fragment
2185
+ to indicate that execution of the related selection set should be deferred . When
2186
+ a request includes the `@defer ` directive , the response may consist of multiple
2187
+ payloads : the initial payload containing all non -deferred data , while subsequent
2188
+ payloads include deferred data .
2189
+
2190
+ The `@include ` and `@skip ` directives take precedence over `@defer `.
2190
2191
2191
2192
```graphql example
2192
- query myQuery ($shouldDefer : Boolean ) {
2193
+ query myQuery ($shouldDefer : Boolean ! = true ) {
2193
2194
user {
2194
2195
name
2195
2196
... someFragment @defer (label : " someLabel" , if : $shouldDefer )
@@ -2208,12 +2209,12 @@ fragment someFragment on User {
2208
2209
- `if : Boolean ! = true ` - When `true `, fragment _should_ be deferred (see
2209
2210
related note below). When `false `, fragment will not be deferred and data will
2210
2211
be included in the initial response . Defaults to `true ` when omitted .
2211
- - `label : String ` - May be used by GraphQL clients to identify the data from
2212
- responses and associate it with the corresponding defer directive . If
2213
- provided , the GraphQL service must add it to the corresponding pending object
2214
- in the response . ` label ` must be unique label across all ` @defer ` and
2215
- `@stream ` directives in a document . ` label ` must not be provided as a
2216
- variable .
2212
+ - `label : String ` - An optional string literal (variables are disallowed) used
2213
+ by GraphQL clients to identify data from responses and associate it with the
2214
+ corresponding defer directive . If provided , the GraphQL service must include
2215
+ this label in the corresponding pending object within the response . The
2216
+ `label ` argument must be unique across all ` @defer ` and ` @stream ` directives
2217
+ in the document .
2217
2218
2218
2219
### @stream
2219
2220
@@ -2225,19 +2226,25 @@ directive @stream(
2225
2226
) on FIELD
2226
2227
```
2227
2228
2228
- The `@stream ` directive may be provided for a field of `List ` type so that the
2229
- backend can leverage technology such as asynchronous iterators to provide a
2230
- partial list in the initial response , and additional list items in subsequent
2231
- responses . `@include ` and `@skip ` take precedence over `@stream `. The
2232
- [Stream Directives Are Used On List Fields ](#sec-Stream-Directives-Are-Used-On-List-Fields)
2233
- validation rule is used to prevent the `@stream` directive from being applied to
2234
- a field that is not a `List` type.
2229
+ The `@stream ` directive may be provided for a field whose type incorporates a
2230
+ `List ` type modifier ; the directive enables the backend to leverage technology
2231
+ such as asynchronous iterators to provide a partial list in the initial payload ,
2232
+ and additional list items in subsequent payloads .
2233
+
2234
+ The `@include ` and `@skip ` directives take precedence over `@stream `.
2235
+
2236
+ Note : The [Directives Are Defined ](#sec-Directives-Are-Defined) validation rule
2237
+ ensures that GraphQL Operations containing the `@stream` directive cannot be
2238
+ executed by a GraphQL service that does not support this directive.
2235
2239
2236
2240
```graphql example
2237
- query myQuery($shouldStream : Boolean ) {
2241
+ query myQuery($shouldStream : Boolean ! = true ) {
2238
2242
user {
2239
2243
friends (first : 10 ) {
2240
- nodes @stream (label : " friendsStream" , initialCount : 5 , if : $shouldStream )
2244
+ nodes
2245
+ @stream (label : " friendsStream" , initialCount : 5 , if : $shouldStream ) {
2246
+ name
2247
+ }
2241
2248
}
2242
2249
}
2243
2250
}
@@ -2248,12 +2255,12 @@ query myQuery($shouldStream: Boolean) {
2248
2255
- `if : Boolean ! = true ` - When `true `, field _should_ be streamed (see related
2249
2256
note below). When `false `, the field will not be streamed and all list items
2250
2257
will be included in the initial response . Defaults to `true ` when omitted .
2251
- - `label : String ` - May be used by GraphQL clients to identify the data from
2252
- responses and associate it with the corresponding stream directive . If
2253
- provided , the GraphQL service must add it to the corresponding pending object
2254
- in the response . ` label ` must be unique label across all ` @defer ` and
2255
- `@stream ` directives in a document . ` label ` must not be provided as a
2256
- variable .
2258
+ - `label : String ` - An optional string literal (variables are disallowed) used
2259
+ by GraphQL clients to identify data from responses and associate it with the
2260
+ corresponding stream directive . If provided , the GraphQL service must include
2261
+ this label in the corresponding pending object within the response . The
2262
+ `label ` argument must be unique across all ` @defer ` and ` @stream ` directives
2263
+ in the document .
2257
2264
- `initialCount : Int ` - The number of list items the service should return as
2258
2265
part of the initial response . If omitted , defaults to `0`. A field error will
2259
2266
be raised if the value of this argument is less than `0`.
0 commit comments