Skip to content

feat: add supplemental SDL config#4803

Open
yaacovCR wants to merge 4 commits into
graphql:17.x.xfrom
yaacovCR:extend-build-schema
Open

feat: add supplemental SDL config#4803
yaacovCR wants to merge 4 commits into
graphql:17.x.xfrom
yaacovCR:extend-build-schema

Conversation

@yaacovCR

@yaacovCR yaacovCR commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Add supplementalConfig to buildSchema, buildASTSchema, and extendSchema so SDL-defined schema elements can receive constructor-only configuration that SDL cannot express. The option is validated by default and can be bypassed with assumeValidSupplementalConfig for config that has already been checked.

The schema-level config is keyed by schema element kind and GraphQL name:

  • scalarTypes: serialize, parseValue, parseLiteral, coerceOutputValue, coerceInputValue, coerceInputLiteral, valueToLiteral, and extensions.

  • objectTypes: fields, isTypeOf, and extensions.

  • interfaceTypes: fields, resolveType, and extensions.

  • unionTypes: resolveType and extensions.

  • enumTypes: values and extensions; enum values can define an internal value and extensions.

  • inputObjectTypes: fields and extensions.

  • directives: args and extensions.

  • extensions: schema extensions.

Field supplements can be a resolver function or an object with resolve, subscribe, args, and extensions. Argument, input field, directive argument, enum value, and type supplements apply only to schema elements declared or extended by the SDL document, and unmatched supplemental config is rejected by default.

This lets SDL own the type-system shape while JavaScript supplies runtime behavior and host-language metadata: field resolvers, subscription functions, abstract type resolution, object type predicates, custom scalar coercion and literal conversion, enum runtime values, and extensions.

Related issues: #497, #499, #516, #525, #604, #622, #1379, #1858.

Related prior PRs: #469, #947, #1384, #1987.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@yaacovCR is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@yaacovCR yaacovCR added the PR: feature 🚀 requires increase of "minor" version number label Jun 9, 2026
@yaacovCR yaacovCR force-pushed the extend-build-schema branch from 3b4b876 to 2dc804b Compare June 9, 2026 16:23
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
graphql-js Ready Ready Preview, Comment Jun 10, 2026 4:05am

Request Review

@yaacovCR yaacovCR force-pushed the extend-build-schema branch 2 times, most recently from b59fc35 to 18c849d Compare June 9, 2026 18:45
yaacovCR added 4 commits June 10, 2026 06:04
Add `supplementalConfig` to `buildSchema`, `buildASTSchema`, and `extendSchema` so SDL-defined schema elements can receive constructor-only configuration that SDL cannot express. The option is validated by default and can be bypassed with `assumeValidSupplementalConfig` for config that has already been checked.

The schema-level config is keyed by schema element kind and GraphQL name:

- `scalarTypes`: `serialize`, `parseValue`, `parseLiteral`, `coerceOutputValue`, `coerceInputValue`, `coerceInputLiteral`, `valueToLiteral`, and `extensions`.

- `objectTypes`: `fields`, `isTypeOf`, and `extensions`.

- `interfaceTypes`: `fields`, `resolveType`, and `extensions`.

- `unionTypes`: `resolveType` and `extensions`.

- `enumTypes`: `values` and `extensions`; enum values can define an internal `value` and `extensions`.

- `inputObjectTypes`: `fields` and `extensions`.

- `directives`: `args` and `extensions`.

- `extensions`: schema extensions.

Field supplements can be a resolver function or an object with `resolve`, `subscribe`, `args`, and `extensions`. Argument, input field, directive argument, enum value, and type supplements apply only to schema elements declared or extended by the SDL document, and unmatched supplemental config is rejected by default.

This lets SDL own the type-system shape while JavaScript supplies runtime behavior and host-language metadata: field resolvers, subscription functions, abstract type resolution, object type predicates, custom scalar coercion and literal conversion, enum runtime values, and extensions.

Related issues: graphql#497, graphql#499, graphql#516, graphql#525, graphql#604, graphql#622, graphql#1379, graphql#1858.

Related prior PRs: graphql#469, graphql#947, graphql#1384, graphql#1987.
@yaacovCR yaacovCR force-pushed the extend-build-schema branch from 18c849d to 1bb3f67 Compare June 10, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature 🚀 requires increase of "minor" version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant