[Fusion] Include internal types/fields during source schema validation#9554
[Fusion] Include internal types/fields during source schema validation#9554
Conversation
There was a problem hiding this comment.
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
@lookupfield 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@lookupfield 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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9554 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary of the changes (Less than 80 chars)