Skip to content

Fix composite field must have selection set rule#9555

Merged
michaelstaib merged 2 commits intomainfrom
mst/validation-fix
Apr 16, 2026
Merged

Fix composite field must have selection set rule#9555
michaelstaib merged 2 commits intomainfrom
mst/validation-fix

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 06:04
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 fixes validation of the GraphQL “leaf field selections” rule so composite fields wrapped in list/non-null types correctly require a selection set (notably affecting introspection fields like types { ofType } and fields { type }), and adds regression coverage in Fusion ASP.NET Core tests.

Changes:

  • Unwrap parent types in LeafFieldSelectionsRule before looking up fields, ensuring wrapped composite parent types are validated correctly.
  • Add two new Fusion gateway introspection regression tests plus their snapshot baselines for missing selection sets.
  • Default Fusion test gateway hosting environment to Development to avoid environment-driven security behavior interfering with tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/HotChocolate/Core/src/Validation/Rules/LeafFieldSelectionsRule.cs Unwraps parentType via NamedType() before validating field selections.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/IntrospectionTests.cs Adds regression tests for introspection composite fields without selection sets.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs Injects a default IHostEnvironment (Development) for gateway test servers.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/snapshots/IntrospectionTests.Introspection_OfType_Without_SelectionSet.yaml Snapshot baseline for ofType missing selection set error.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/snapshots/IntrospectionTests.Introspection_Field_Type_Without_SelectionSet.yaml Snapshot baseline for type missing selection set error.

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

Comment thread src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs Outdated
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