Skip to content

Commit

Permalink
Include the compatible graphql version to incremental delivery docs (#…
Browse files Browse the repository at this point in the history
…7834)

Updated the [documentation on incremental
delivery](https://www.apollographql.com/docs/apollo-server/workflow/requests#incremental-delivery-experimental)
to include the specific prerelease version of graphQL that Apollo Server
is compatible with for incremental delivery.

The current docs state "As of September 2022...", but a new pre release
version was made available in 2023
https://github.com/graphql/graphql-js/releases/tag/v17.0.0-alpha.3 and
this appears to contain a breaking change in the incremental payload
delivery.
  • Loading branch information
thomaswelton authored Mar 5, 2024
1 parent c156742 commit 5704146
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
node-version: "18"
# Install a prerelease of graphql-js 17 with incremental delivery support.
# --legacy-peer-deps because nothing expects v17 yet.
- run: npm i --legacy-peer-deps graphql@17.0.0-alpha.1.canary.pr.3361.04ab27334641e170ce0e05bc927b972991953882
- run: npm i --legacy-peer-deps graphql@17.0.0-alpha.2
- run: npm run test:ci
- run: npm run test:smoke

Expand Down
2 changes: 1 addition & 1 deletion docs/source/workflow/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ For more details, see [the CSRF prevention documentation](../security/cors#preve

## Incremental delivery (experimental)

Incremental delivery is a [Stage 2: Draft Proposal](https://github.com/graphql/graphql-spec/pull/742) to the GraphQL specification which adds `@defer` and `@stream` executable directives. These directives allow clients to specify that parts of an operation can be sent after an initial response, so that slower fields do not delay all other fields. As of September 2022, the `graphql` library (also known as `graphql-js`) upon which Apollo Server is built implements incremental delivery only in the unreleased major version 17. If a pre-release of `graphql@17` is installed in your server, Apollo Server 4 can execute these incremental delivery directives and provide streaming [`multipart/mixed`](https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md) responses.
Incremental delivery is a [Stage 2: Draft Proposal](https://github.com/graphql/graphql-spec/pull/742) to the GraphQL specification which adds `@defer` and `@stream` executable directives. These directives allow clients to specify that parts of an operation can be sent after an initial response, so that slower fields do not delay all other fields. As of September 2022, the `graphql` library (also known as `graphql-js`) upon which Apollo Server is built implements incremental delivery only in the unreleased major version 17. If a pre-release of `graphql@17.0.0-alpha.2` is installed in your server, Apollo Server 4 can execute these incremental delivery directives and provide streaming [`multipart/mixed`](https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md) responses.

Support for incremental delivery in graphql version 17 is [opt-in](https://github.com/robrichard/defer-stream-wg/discussions/12), meaning the directives are not defined by default. In order to use `@defer` or `@stream`, you must provide the appropriate definition(s) in your SDL. The definitions below can be pasted into your schema as-is:

Expand Down
2 changes: 1 addition & 1 deletion smoke-test/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ npm i
if [[ -n "${INCREMENTAL_DELIVERY_TESTS_ENABLED:-}" ]]; then
npm i --no-save --legacy-peer-deps \
"$TARBALL_DIR"/*.tgz \
graphql@17.0.0-alpha.1.canary.pr.3361.04ab27334641e170ce0e05bc927b972991953882
graphql@17.0.0-alpha.2
else
npm i --no-save "$TARBALL_DIR"/*.tgz
fi
Expand Down

0 comments on commit 5704146

Please sign in to comment.