Skip to content

[Fusion] Include internal types/fields during source schema validation#9554

Merged
glen-84 merged 2 commits intomainfrom
gai/internal-source-schema-validation
Apr 15, 2026
Merged

[Fusion] Include internal types/fields during source schema validation#9554
glen-84 merged 2 commits intomainfrom
gai/internal-source-schema-validation

Conversation

@glen-84
Copy link
Copy Markdown
Member

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

Summary of the changes (Less than 80 chars)

  • [Fusion] Include internal types/fields during source schema validation.

Copilot AI review requested due to automatic review settings April 15, 2026 15:24
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

Updates Fusion composition so source schema validation also processes internal types/fields, aligning validation behavior with what can exist in source schemas (even if internal members are excluded from the final composed schema).

Changes:

  • Removed filtering that previously skipped internal object types and internal output fields during source schema validation event publishing.
  • Updated the k6 eShop.Reviews benchmark schema/resolver to make an internal @lookup field nullable (matching lookup validation guidance).
  • Added/updated the benchmark gateway Fusion archive (gateway.far) to reflect the current benchmark composition inputs.

Reviewed changes

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

File Description
src/HotChocolate/Fusion/src/Fusion.Composition/SourceSchemaValidator.cs Publishes validation events for all types/fields (including internal) so rules can validate internal members too.
src/HotChocolate/Fusion/benchmarks/k6/eShop.Reviews/schema.graphqls Makes Query.product nullable to satisfy lookup-return-type validation for an internal lookup field.
src/HotChocolate/Fusion/benchmarks/k6/eShop.Reviews/ProductQueries.cs Aligns resolver nullability with the updated schema (Product?).
src/HotChocolate/Fusion/benchmarks/k6/eShop.Gateway/gateway.far Adds/updates the gateway configuration archive used by the k6 benchmark gateway.
Comments suppressed due to low confidence (1)

src/HotChocolate/Fusion/src/Fusion.Composition/SourceSchemaValidator.cs:50

  • This change alters SourceSchemaValidator to also publish events for internal types/fields; there are existing rule unit tests under Fusion.Composition.Tests, but none appear to assert that internal types/fields are included in source schema validation. Add a targeted test case (e.g., an @internal @lookup field returning a non-null type) to ensure the expected warnings/errors are produced for internal members and to prevent regressions.
            foreach (var type in schema.Types)
            {
                PublishEvent(new TypeEvent(type, schema), context);

                if (type is MutableComplexTypeDefinition complexType)
                {
                    PublishEvent(new ComplexTypeEvent(complexType, schema), context);

                    foreach (var field in complexType.Fields)
                    {
                        PublishEvent(new OutputFieldEvent(field, type, schema), context);

                        foreach (var argument in field.Arguments)
                        {
                            PublishEvent(
                                new FieldArgumentEvent(argument, field, type, schema), context);
                        }
                    }

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

@glen-84 glen-84 merged commit fc8d3d6 into main Apr 15, 2026
138 checks passed
@glen-84 glen-84 deleted the gai/internal-source-schema-validation branch April 15, 2026 15:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (58d2bd0) to head (6836530).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9554   +/-   ##
============================
============================

☔ 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