Skip to content

Support extending fields in Mutable SchemaParser#9620

Merged
glen-84 merged 1 commit intomainfrom
gai/mutable-field-extensions
Apr 29, 2026
Merged

Support extending fields in Mutable SchemaParser#9620
glen-84 merged 1 commit intomainfrom
gai/mutable-field-extensions

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Apr 29, 2026

Allow object and interface type extensions to redeclare an existing
field to add directives or new arguments, per graphql-spec PR #1196.
The description on an extension field/argument may be omitted, but
must match the original exactly when provided.
Copilot AI review requested due to automatic review settings April 29, 2026 13:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Mutable SchemaParser to support “field extension” semantics for object and interface type extensions, allowing extensions to redeclare existing fields/arguments to add directives and/or additional arguments while validating that core definition aspects don’t change.

Changes:

  • Reordered parse phases so directive definitions are built before applying type extensions (to correctly respect repeatability when merging directives).
  • Added field/argument extension logic that merges directives and arguments, while rejecting type/description/default-value mismatches and duplicate names within an extension.
  • Added comprehensive unit tests covering field/argument extension behavior, directive repeatability rules, and mismatch error cases.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/HotChocolate/Mutable/test/Types.Mutable.Tests/SchemaParserTests.cs Adds tests for extending existing fields/arguments via SDL extensions and validates error conditions.
src/HotChocolate/Mutable/src/Types.Mutable/Serialization/SchemaParser.cs Implements field/argument extension logic (merge directives/args) and reorders parsing steps for correct directive repeatability handling.
src/HotChocolate/Mutable/src/Types.Mutable/Properties/MutableResources.resx Adds new localized error message templates for extension mismatch scenarios and non-repeatable directive reapplication.
src/HotChocolate/Mutable/src/Types.Mutable/Properties/MutableResources.Designer.cs Updates generated resource accessors for the new error messages.
Files not reviewed (1)
  • src/HotChocolate/Mutable/src/Types.Mutable/Properties/MutableResources.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 merged commit e118ba7 into main Apr 29, 2026
272 of 275 checks passed
@glen-84 glen-84 deleted the gai/mutable-field-extensions branch April 29, 2026 13:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (6a3b7a3) to head (420377b).
⚠️ Report is 1167 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #9620       +/-   ##
==========================================
- Coverage   74.16%       0   -74.17%     
==========================================
  Files        2677       0     -2677     
  Lines      140790       0   -140790     
  Branches    16371       0    -16371     
==========================================
- Hits       104421       0   -104421     
+ Misses      30774       0    -30774     
+ Partials     5595       0     -5595     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants