Skip to content

Add support for graphql-js v17 - #8313

Closed
egoodwinx wants to merge 7 commits into
ardatan:masterfrom
egoodwinx:feat/graphql-17-support
Closed

Add support for graphql-js v17#8313
egoodwinx wants to merge 7 commits into
ardatan:masterfrom
egoodwinx:feat/graphql-17-support

Conversation

@egoodwinx

@egoodwinx egoodwinx commented Jul 22, 2026

Copy link
Copy Markdown

Description

Adds support for graphql-js v17 while continuing to support v15 and v16 (the existing peer range).
Replaced the stale 4-bullet description with the full, accurate list (all the fixes we discussed were missing: the SDL-default-value bug, graphqlJSCompat.ts, the stale-closure fix, the two patches, CI changes).
Filled in "How Has This Been Tested?" with the real verification you actually did (typecheck/lint/prettier/build/full jest across v15/v16/v17).
Checked off boxes that are now genuinely true (no new warnings, tests added, tests pass locally) and left "documentation update" / "downstream modules" unchecked since those are still open.
Kept a note about Yoga, but reframed it from an in-progress status line into a clear scope caveat: executor-yoga's peer range is intentionally untouched, and that work is separate/not part of this PR — so a reviewer doesn't read "currently patching" as something still owed inside this PR.
Added a short "Further comments" note that this went through review during development and several bugs were caught and fixed inline rather than deferred.

Related # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • This change requires a documentation update

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take
action on it as appropriate

How Has This Been Tested?

Verified locally against graphql-js 15.10.2, 16.14.0/16.14.2, and 17.0.2 (pinning each via
scripts/match-graphql.js and resetting the lockfile), running: tsc --noEmit, npm run lint,
npm run prettier:check, npm run build && npx bob check, and the full jest suite. All pass
cleanly on all three versions; the only failures are pre-existing, sandbox-only Puppeteer/Chrome
download failures unrelated to this change.

  • Unit Tests

Test Environment:

  • OS: Linux (WSL2)
  • @graphql-tools/...: all packages in this monorepo
  • NodeJS: 22 / 24 / 26

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

This PR was reviewed with an automated multi-pass code review during development; several
bugs it surfaced (a sources map that silently broke nested-variable resolution for custom
scalars implementing coerceInputLiteral, a stale-closure bug in scalar rebuilding, and the
SDL-default-value bug in getArgumentValues) were found and fixed as part of this PR rather
than left for follow-up.

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ce9cd5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@graphql-tools/executor-urql-exchange Minor
@graphql-tools/executor-apollo-link Minor
@graphql-tools/git-loader Minor
@graphql-tools/executor Minor
@graphql-tools/optimize Minor
@graphql-tools/schema Minor
@graphql-tools/utils Minor
@graphql-tools/webpack-loader Patch
graphql-tools Patch
@graphql-tools/load Patch
@graphql-tools/mock Patch
@graphql-tools/graphql-tag-pluck Patch
@graphql-tools/import Patch
@graphql-tools/links Patch
@graphql-tools/merge Patch
@graphql-tools/node-require Patch
@graphql-tools/relay-operation-optimizer Patch
@graphql-tools/resolvers-composition Patch
@graphql-tools/apollo-engine-loader Patch
@graphql-tools/code-file-loader Patch
@graphql-tools/github-loader Patch
@graphql-tools/graphql-file-loader Patch
@graphql-tools/json-file-loader Patch
@graphql-tools/module-loader Patch
@graphql-tools/url-loader Patch
@graphql-tools/executor-envelop Patch
@graphql-tools/executor-legacy-ws Patch
@graphql-tools/executor-yoga Patch
@graphql-tools/jest-transform Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0376894d-5aa5-43e5-806f-4756f9acfdde

📥 Commits

Reviewing files that changed from the base of the PR and between f768b60 and ce9cd5e.

📒 Files selected for processing (1)
  • packages/loaders/url/tests/url-loader-browser.spec.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added GraphQL.js v17 compatibility across execution, coercion, variable handling, and schema/scalar behavior.
    • Added abort-signal support and async helper utilities for resolvers.
    • Expanded GraphQL.js v17 support for Apollo Link and urql integrations.
  • Bug Fixes
    • Improved default and variable coercion diagnostics, including nested-value errors.
    • Corrected directive evaluation with GraphQL.js v17 variable handling.
    • Updated fragment parsing and schema/AST behavior for GraphQL.js v17.
  • Tests
    • Expanded compatibility coverage across GraphQL.js versions 15–17.

Walkthrough

This change adds GraphQL.js v17 compatibility across variable coercion, executor resolver metadata, scalar resolver configuration, package support, type patches, CI, and version-aware tests.

Changes

GraphQL.js v17 compatibility

Layer / File(s) Summary
Compatibility helpers and argument coercion
packages/utils/src/graphqlJSCompat.ts, packages/utils/src/getArgumentValues.ts, packages/utils/src/getDirectiveExtensions.ts, packages/utils/src/collectFields.ts, packages/utils/tests/getArgumentValues.spec.ts
Adds structured variable values, runtime-to-AST conversion, v17-compatible argument and directive coercion, and related tests.
Executor coercion and resolver metadata
packages/executor/src/execution/execute.ts, packages/executor/src/execution/values.ts, packages/executor/src/execution/__tests__/*
Updates variable coercion and diagnostics, exposes abort and async helpers, and adapts resolver and stream directive variable values.
Scalar resolver configuration
packages/schema/src/addResolversToSchema.ts, packages/utils/tests/mapSchema.test.ts
Maps legacy scalar methods to GraphQL.js v17 coercion methods and removes conflicting literal parsing configuration when applicable.
Version adoption and compatibility validation
package.json, packages/*/package.json, packages/loaders/git/tests/*, packages/optimize/tests/*, packages/schema/tests/*, patches/*, .github/workflows/tests.yml, .changeset/*
Enables GraphQL.js v17 in package metadata and CI, updates type patches, records release support, and adjusts version-specific AST, parser, and error expectations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Executor
  participant GraphQLJSCompat
  participant ResolverInfo
  participant DirectiveEvaluation
  Executor->>GraphQLJSCompat: convert execution variable values
  GraphQLJSCompat-->>Executor: return GraphQL.js-compatible values
  Executor->>ResolverInfo: provide variableValues, signal, and async helpers
  Executor->>DirectiveEvaluation: evaluate stream directives with converted values
Loading

Possibly related PRs

Suggested reviewers: ardatan, enisdenjo

Poem

A rabbit maps each value right,
Through GraphQL’s changing type-light.
Scalars coerce, executors flow,
Tests mark what versions show.
V17 now joins the site.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adding graphql-js v17 support.
Description check ✅ Passed The description directly explains graphql-js v17 support, compatibility with v15 and v16, testing, and scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/schema/src/addResolversToSchema.ts (2)

189-215: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep updateResolversInPlace consistent with the cloned-schema path.

The in-place path updates parseValue/coerceInputValue, but updateResolversInPlace: true keeps the existing scalar’s original parseLiteral even when resolver input coercing is overridden. Since execution falls back to parseLiteral when a scalar has no coerceInputLiteral, remove/override the literal parser in the same scalar-override branch used by the mapped-schema path so both modes use the same new input coercer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/schema/src/addResolversToSchema.ts` around lines 189 - 215, Update
the scalar override branch in updateResolversInPlace so overriding input
coercion also removes or replaces the existing scalar parseLiteral handler,
matching the cloned-schema path. Ensure execution cannot retain the original
parseLiteral when resolver input coercing is provided, so both schema update
modes use the new coercer consistently.

313-354: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clear the inherited coerceInputLiteral when overriding scalar coercion.

GraphQLScalarType.toConfig() carries the current scalar coercion methods, including coerceInputLiteral. If a resolver only overrides parseValue/coerceInputValue without also overriding literal coercion, leave coerceInputLiteral on the copied config and literal argument coercion can still use the old resolver implementation. Remove it unless the resolver supplies a fresh coerceInputLiteral.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/schema/src/addResolversToSchema.ts` around lines 313 - 354, Update
the scalar coercion cleanup after the resolver fields are copied so that when
coerceInputValueOverridden is true and parseLiteralOverridden is false, it also
removes the inherited coerceInputLiteral configuration. Preserve
coerceInputLiteral when the resolver explicitly overrides literal coercion,
using the existing detection symbols in the surrounding scalar setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/utils/src/getArgumentValues.ts`:
- Around line 52-73: Update the missing-variable handling in getArgumentValues
to reuse the existing graphql v17 arg.default coercion path when the referenced
variable has no coerced value, instead of checking only legacy arg.defaultValue.
Preserve the current coercion and invalid-default error behavior, while ensuring
field arguments referencing absent variables receive the v17 default before
non-null validation.

In `@packages/utils/src/graphqlJSCompat.ts`:
- Around line 95-104: Update buildVariableSources to preserve each variable’s
declared GraphQL input type instead of assigning anyValueType to every variable.
Pass variableDefinitions alongside variableValues from toGraphQLJSVariableValues
and build each source signature from the corresponding definition type,
preserving nested enum and custom-scalar literal/coercion behavior.

---

Outside diff comments:
In `@packages/schema/src/addResolversToSchema.ts`:
- Around line 189-215: Update the scalar override branch in
updateResolversInPlace so overriding input coercion also removes or replaces the
existing scalar parseLiteral handler, matching the cloned-schema path. Ensure
execution cannot retain the original parseLiteral when resolver input coercing
is provided, so both schema update modes use the new coercer consistently.
- Around line 313-354: Update the scalar coercion cleanup after the resolver
fields are copied so that when coerceInputValueOverridden is true and
parseLiteralOverridden is false, it also removes the inherited
coerceInputLiteral configuration. Preserve coerceInputLiteral when the resolver
explicitly overrides literal coercion, using the existing detection symbols in
the surrounding scalar setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56f44631-bb26-48ef-ade2-2b0b1a78f5df

📥 Commits

Reviewing files that changed from the base of the PR and between f0782ce and ccbcce9.

📒 Files selected for processing (24)
  • .changeset/bold-webs-behave.md
  • package.json
  • packages/executor/package.json
  • packages/executor/src/execution/__tests__/executor-test.ts
  • packages/executor/src/execution/__tests__/oneOf-test.ts
  • packages/executor/src/execution/__tests__/variables-test.ts
  • packages/executor/src/execution/execute.ts
  • packages/executor/src/execution/values.ts
  • packages/executors/apollo-link/package.json
  • packages/executors/urql-exchange/package.json
  • packages/loaders/git/tests/loader.spec.ts
  • packages/optimize/tests/remove-empty-nodes.spec.ts
  • packages/optimize/tests/remove-loc.spec.ts
  • packages/schema/src/addResolversToSchema.ts
  • packages/schema/tests/schemaGenerator.test.ts
  • packages/utils/src/collectFields.ts
  • packages/utils/src/getArgumentValues.ts
  • packages/utils/src/getDirectiveExtensions.ts
  • packages/utils/src/graphqlJSCompat.ts
  • packages/utils/src/index.ts
  • packages/utils/tests/getArgumentValues.spec.ts
  • packages/utils/tests/mapSchema.test.ts
  • patches/@types+relay-compiler+8.0.4.patch
  • patches/subscriptions-transport-ws+0.11.0.patch

Comment thread packages/utils/src/getArgumentValues.ts Outdated
Comment thread packages/utils/src/graphqlJSCompat.ts

@enisdenjo enisdenjo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'@graphql-tools/utils': minor
---

Add support for graphql-js v17

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this PR is not only about bumping the version, it would be great to summarise what you did in order to get the v17 working. nothing too fancy, a summary of which issues were addressed

@ardatan ardatan mentioned this pull request Aug 5, 2026
@ardatan ardatan closed this in #8346 Aug 6, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants