Open
Conversation
|
@egoodwinx is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Author
This was referenced Jan 26, 2026
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.
Summary
This PR adds the ability to extend and modify existing fields when using GraphQL schema extensions, enabling more flexible schema composition patterns. Previously, extending a type with a field that already existed would cause a validation error. Now, extensions can override field properties and additively merge field arguments.
Motivation
RFC: graphql/graphql-spec#1162 (comment)
Changes
Core Implementation
extendSchema.ts
Added mergeFieldConfigs() function to intelligently merge field configurations
Added mergeFieldMaps() function to merge field maps from extensions
Modified buildFieldMap() to detect and merge duplicate field definitions
Updated extendObjectType() and extendInterfaceType() to use field merging
Merging Behavior:
Field type: Incoming type overrides existing (allows type evolution)
Description: Incoming description overrides existing
Arguments: Merged additively (existing + new arguments)
Deprecation reason: Incoming reason overrides existing
Tests
src/utilities/tests/extendSchema-test.ts
Added comprehensive test suite for field merging scenarios:
✅ Merging field types when extending with same field name
✅ Merging field arguments additively
✅ Merging multiple extensions on the same field
✅ Merging field descriptions
✅ Preserving original field properties when not overridden
✅ Allowing overriding field properties with extensions
✅ Interface field merging
✅ Complex multi-extension scenarios