Skip to content

Commit d6b47df

Browse files
Adding first draft of incremental delivery spec artifact (#67)
Co-authored-by: Martin Bonnin <[email protected]>
1 parent cb17d48 commit d6b47df

File tree

8 files changed

+693
-0
lines changed

8 files changed

+693
-0
lines changed

__index__.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
- **[federation/v2.9](/federation/v2.9)** ([📄 graphql](federation/v2.9/federation-v2.9.graphql))
2020
- **[inaccessible/v0.1](/inaccessible/v0.1)** ([📄 graphql](inaccessible/v0.1/inaccessible-v0.1.graphql))
2121
- **[inaccessible/v0.2](/inaccessible/v0.2)** ([📄 graphql](inaccessible/v0.2/inaccessible-v0.2.graphql))
22+
- **[incremental/v0.1](/incremental/v0.1)** ([📄 graphql](incremental/v0.1/incremental-v0.1.graphql))
23+
- **[incremental/v0.2](/incremental/v0.2)** ([📄 graphql](incremental/v0.2/incremental-v0.2.graphql))
2224
- **[join/v0.1](/join/v0.1)** ([📄 graphql](join/v0.1/join-v0.1.graphql))
2325
- **[join/v0.2](/join/v0.2)** ([📄 graphql](join/v0.2/join-v0.2.graphql))
2426
- **[join/v0.3](/join/v0.3)** ([📄 graphql](join/v0.3/join-v0.3.graphql))

incremental/v0.1/http.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# HTTP Request Headers
2+
3+
In order for the server to know that the client can parse the incremental delivery response format, the HTTP request must include the following header:
4+
5+
## Accept
6+
7+
`multipart/mixed;deferSpec=20220824`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Used to imply de-prioritization, that causes the fragment to be omitted in the initial response, and delivered as a subsequent response afterward.
3+
4+
Arguments:
5+
* `if: Boolean`
6+
* When `true` fragment may be deferred, if omitted defaults to `true`.
7+
* `label: String`
8+
* A unique label across all `@defer` and `@stream` directives in an operation.
9+
* This `label` should be used by GraphQL clients to identify the data from patch responses and associate it with the correct fragment.
10+
* If provided, the GraphQL Server must add it to the payload.
11+
"""
12+
directive @defer(
13+
label: String
14+
if: Boolean! = true
15+
) on FRAGMENT_SPREAD | INLINE_FRAGMENT
16+
17+
"""
18+
This directive may be provided for a field of `List` type so that the backend can leverage technology such asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses.
19+
20+
Arguments:
21+
* `if: Boolean`
22+
* When `true` field may be streamed, if omitted defaults to `true`.
23+
* `label: String`
24+
* A unique label across all `@defer` and `@stream` directives in an operation.
25+
* This `label` should be used by GraphQL clients to identify the data from patch responses and associate it with the correct fragments.
26+
* If provided, the GraphQL Server must add it to the payload.
27+
* `initialCount: Int`
28+
* The number of list items the server should return as part of the initial response.
29+
"""
30+
directive @stream(
31+
label: String
32+
if: Boolean! = true
33+
initialCount: Int = 0
34+
) on FIELD

incremental/v0.1/incremental-v0.1.md

Lines changed: 309 additions & 0 deletions
Large diffs are not rendered by default.

incremental/v0.2/http.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# HTTP Request Headers
2+
3+
In order for the server to know that the client can parse the incremental delivery response format, the HTTP request must include the following header:
4+
5+
## Accept
6+
7+
`multipart/mixed;incrementalSpec=v0.2`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Used to imply de-prioritization, that causes the fragment to be omitted in the initial response, and delivered as a subsequent response afterward.
3+
4+
Arguments:
5+
* `if: Boolean`
6+
* When `true` fragment may be deferred, if omitted defaults to `true`.
7+
* `label: String`
8+
* A unique label across all `@defer` and `@stream` directives in an operation.
9+
* This `label` should be used by GraphQL clients to identify the data from patch responses and associate it with the correct fragment.
10+
* If provided, the GraphQL Server must add it to the payload.
11+
"""
12+
directive @defer(
13+
label: String
14+
if: Boolean! = true
15+
) on FRAGMENT_SPREAD | INLINE_FRAGMENT
16+
17+
"""
18+
This directive may be provided for a field of `List` type so that the backend can leverage technology such asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses.
19+
20+
Arguments:
21+
* `if: Boolean`
22+
* When `true` field may be streamed, if omitted defaults to `true`.
23+
* `label: String`
24+
* A unique label across all `@defer` and `@stream` directives in an operation.
25+
* This `label` should be used by GraphQL clients to identify the data from patch responses and associate it with the correct fragments.
26+
* If provided, the GraphQL Server must add it to the payload.
27+
* `initialCount: Int`
28+
* The number of list items the server should return as part of the initial response.
29+
"""
30+
directive @stream(
31+
label: String
32+
if: Boolean! = true
33+
initialCount: Int = 0
34+
) on FIELD

incremental/v0.2/incremental-v0.2.md

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
[federation v2.9](/federation/v2.9) provides graph composition primitives for use in subgraphs.
2121

22+
## incremental v0.2
23+
24+
[incremental v0.2](/incremental/v0.2) provides specification and client usage details for the response format used with the {@defer} and {@stream} directives.
25+
2226
## join v0.3
2327

2428
[join v0.3](/join/v0.3) declaratively describes joins between types in a supergraph.

0 commit comments

Comments
 (0)