You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Document `@stream` directive support in defer.mdx
Added support for the `@stream` directive and updated incremental delivery protocol information.
* Apply suggestion from @BoD
* Mention `@stream` in title and add support matrix
* Update docs/source/_sidebar.yaml
Co-authored-by: Martin Bonnin <[email protected]>
---------
Co-authored-by: Martin Bonnin <[email protected]>
The incremental delivery format used by `@defer`[isn't yet standardized](https://github.com/graphql/defer-stream-wg). Apollo Kotlin supports [the format implemented by Apollo Router](https://www.apollographql.com/docs/graphos/routing/operations/defer#specification-status), which is described in this [specification](https://specs.apollo.dev/incremental/v0.1/).
8
+
The incremental delivery format used by `@defer`/`@stream`[isn't yet standardized](https://github.com/graphql/defer-stream-wg). Apollo Kotlin supports [the format implemented by Apollo Router](https://www.apollographql.com/docs/graphos/routing/operations/defer#specification-status), which is described in this [specification](https://specs.apollo.dev/incremental/v0.1/), and the more recent format described in this [specification](https://specs.apollo.dev/incremental/v0.2/)
Similarly to `@defer`, the `@stream` directive can be used to receive the first few items of **lists** in the initial response, while the remaining items arrive later.
64
+
65
+
Note: this directive is only supported when using the [v0.2](https://www.apollographql.com/docs/kotlin/kdoc/apollo-runtime/com.apollographql.apollo.network/-incremental-delivery-protocol/-v0_2/index.html) protocol:
66
+
67
+
```kotlin
68
+
apolloClient =ApolloClient.Builder()
69
+
.networkTransport(
70
+
HttpNetworkTransport.Builder()
71
+
.serverUrl("https://...")
72
+
// Configure the incremental v0.2 protocol // highlight-line
When using `@defer`, the incremental payloads received from the server may each contain GraphQL errors related to the fields being returned.
64
97
These errors are accumulated and exposed in the [`ApolloResponse.errors`](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-api/com.apollographql.apollo.api/-apollo-response/errors.html) field.
@@ -67,6 +100,15 @@ Fetch errors like network failures can also happen during collection of the flow
67
100
68
101
See also the [error handling section](../essentials/errors).
*`@defer` cannot be used with `responseBased` codegen.
72
114
* Some servers might send an empty payload to signal the end of the stream. In such a case you will receive an extra terminal emission. You can filter it out by using `distinctUntilChangedBy()`:
0 commit comments