fix: detect default-value changes on input object fields#4832
Merged
yaacovCR merged 1 commit intoJul 3, 2026
Conversation
findSchemaChanges, findDangerousChanges and findBreakingChanges detect a default-value change on a field argument and a directive argument, but not on an input object field. Changing an input-field default is a dangerous change: a client that omits the field gets different behavior afterward, so schema-evolution checks that rely on these functions miss it. Compare the input-field default the same way findArgChanges does and report INPUT_FIELD_DEFAULT_VALUE_CHANGE (dangerous) on change or removal and INPUT_FIELD_DEFAULT_VALUE_ADDED (safe) on addition, alongside the existing REQUIRED_INPUT_FIELD_ADDED / OPTIONAL_INPUT_FIELD_ADDED members.
|
@spokodev is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
|
Contributor
|
Thanks so much for contributing. Will merge this as a bug-fix. |
yaacovCR
added a commit
to yaacovCR/graphql-js
that referenced
this pull request
Jul 3, 2026
## v17.0.2 (2026-07-03) #### Bug Fix 🐞 * [graphql#4832](graphql#4832) fix: detect default-value changes on input object fields ([@spokodev](https://github.com/spokodev)) #### Polish 💅 * [graphql#4829](graphql#4829) fix(mapSchemaConfig): fix context for schema argument mapper ([@yaacovCR](https://github.com/yaacovCR)) #### Committers: 2 * null([@spokodev](https://github.com/spokodev)) * Yaacov Rydzinski ([@yaacovCR](https://github.com/yaacovCR))
yaacovCR
added a commit
that referenced
this pull request
Jul 3, 2026
## v17.0.2 (2026-07-03) #### Bug Fix 🐞 * [#4832](#4832) fix: detect default-value changes on input object fields ([@spokodev](https://github.com/spokodev)) #### Polish 💅 * [#4829](#4829) fix(mapSchemaConfig): fix context for schema argument mapper ([@yaacovCR](https://github.com/yaacovCR)) #### Committers: 2 * null([@spokodev](https://github.com/spokodev)) * Yaacov Rydzinski ([@yaacovCR](https://github.com/yaacovCR))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
findSchemaChanges,findDangerousChangesandfindBreakingChangesdetect a default-value change on a field argument and on a directive argument, but not on an input object field. Changing the default value of an input-object field is a dangerous change: a client that omits that field gets different behavior after the change. Tooling and CI gates that rely on these functions (schema registries, the graphql-inspector action, custom "is this change safe" checks) ship such a change with no warning.Cause
src/utilities/findSchemaChanges.ts,findInputObjectTypeChangescompares the field type and description but never compares the default value, unlike the siblingfindArgChanges. The gap is long-standing (v16 has the same omission).Fix
Compare the input-field default value the same way
findArgChangesdoes (viagetDefaultValue, which runssortValueNodeso object-field reordering is ignored), and report:INPUT_FIELD_DEFAULT_VALUE_CHANGE(dangerous) when a default is changed or removed,INPUT_FIELD_DEFAULT_VALUE_ADDED(safe) when a default is added.These are new members alongside the existing
REQUIRED_INPUT_FIELD_ADDED/OPTIONAL_INPUT_FIELD_ADDED, so an input-field change is reported under an input-field type rather than reusing the argument type.Added a test in
findBreakingChanges-test.tscovering a removed, changed, and list default. It fails before this change (the input-field changes are not reported); thefindBreakingChangesandfindSchemaChangessuites (55) stay green, and tsc, eslint and prettier pass.