@@ -1947,13 +1947,13 @@ GraphQL implementations that support the type system definition language must
19471947provide the `@deprecated ` directive if representing deprecated portions of the
19481948schema .
19491949
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 .
19571957
19581958GraphQL implementations that support the type system definition language should
19591959provide the `@specifiedBy` directive if representing custom scalar definitions.
@@ -2181,15 +2181,16 @@ directive @defer(
21812181) on FRAGMENT_SPREAD | INLINE_FRAGMENT
21822182```
21832183
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 `.
21902191
21912192```graphql example
2192- query myQuery ($shouldDefer : Boolean ) {
2193+ query myQuery ($shouldDefer : Boolean ! = true ) {
21932194 user {
21942195 name
21952196 ... someFragment @defer (label : " someLabel" , if : $shouldDefer )
@@ -2208,12 +2209,12 @@ fragment someFragment on User {
22082209- `if : Boolean ! = true ` - When `true `, fragment _should_ be deferred (see
22092210 related note below). When `false `, fragment will not be deferred and data will
22102211 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 .
22172218
22182219### @stream
22192220
@@ -2225,19 +2226,25 @@ directive @stream(
22252226) on FIELD
22262227```
22272228
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.
22352239
22362240```graphql example
2237- query myQuery($shouldStream : Boolean ) {
2241+ query myQuery($shouldStream : Boolean ! = true ) {
22382242 user {
22392243 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+ }
22412248 }
22422249 }
22432250}
@@ -2248,12 +2255,12 @@ query myQuery($shouldStream: Boolean) {
22482255- `if : Boolean ! = true ` - When `true `, field _should_ be streamed (see related
22492256 note below). When `false `, the field will not be streamed and all list items
22502257 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 .
22572264- `initialCount : Int ` - The number of list items the service should return as
22582265 part of the initial response . If omitted , defaults to `0`. A field error will
22592266 be raised if the value of this argument is less than `0`.
0 commit comments