Skip to content

fix(deps): support graphql 16 and 17#503

Open
smartive-nicolai[bot] wants to merge 6 commits into
mainfrom
feat/graphql-16-17-compat
Open

fix(deps): support graphql 16 and 17#503
smartive-nicolai[bot] wants to merge 6 commits into
mainfrom
feat/graphql-16-17-compat

Conversation

@smartive-nicolai

Copy link
Copy Markdown
Contributor

Makes the library support both graphql 16 and 17 (the goal of #496 — renovate's bare bump to ^17.0.0 — but implemented so the supported range is ^16.12.0 || ^17.0.0 rather than v17-only).

Changes

  • package.json — widen the graphql range to ^16.12.0 || ^17.0.0 in both dependencies and a new peerDependencies entry (it's a library, so it declares the peer contract while keeping the dep for its own build/test).
  • src/errors.ts — the positional GraphQLError constructor was removed in v17; switched to the object form super(message, { extensions }), typed via GraphQLErrorOptions['extensions']. Valid on v16 (≥16.0) and v17.
  • src/resolvers/utils.ts + src/resolvers/arguments.tsinfo.variableValues changed shape: v16 exposes a plain { [name]: value } record, v17 wraps it as { sources, coerced } (runtime values under .coerced). Added a getVariableValues(info) accessor that reads either shape. Plus a never-narrowing cast in a getTypeName switch default.

All fixes use the v16 ∩ v17 API intersection — no version-pinned behavior.

Verification

Lint + build + full jest suite (api tests against a real Postgres), run against each version:

graphql build lint tests
16.14.2 96/96 + 19 snapshots ✅
17.0.1 96/96 + 19 snapshots ✅

⚠️ Blocked by

The @graphql-codegen/* packages (runtime deps here, used by the gqm CLI) still cap their graphql peer at ^16.0.0 — even the latest @graphql-codegen/cli@7.1.3 / typescript-resolvers@6.0.2. So installing graphql-magic alongside graphql 17 currently triggers an ERESOLVE peer conflict unless --legacy-peer-deps (or an overrides) is used. graphql-magic's own code is fully v17-clean; the only friction is the codegen toolchain's conservative peer range, which the blocker PR above resolves upstream. Once codegen ships graphql-17 peer support, the codegen deps here can be bumped and the install works cleanly without --legacy-peer-deps.

Supersedes #496.

🤖 Generated with Claude Code

Widen the graphql range to ^16.12.0 || ^17.0.0 (dependency + new
peerDependency) and adjust the code to the v16-and-v17 API intersection:

- errors.ts: use the object-form GraphQLError constructor (the positional
  form was removed in v17).
- resolvers: read info.variableValues via a getVariableValues() helper that
  handles both v16's plain record and v17's { sources, coerced } shape.

Verified: build + lint + full jest suite green against both graphql@16.14.2
and graphql@17.0.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@smartive-nicolai smartive-nicolai Bot force-pushed the feat/graphql-16-17-compat branch from 1e5448b to c45c618 Compare June 30, 2026 09:49
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