[Fusion] Add support for source schema extensions#9621
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for “source schema extensions” by allowing a *-extensions.graphql* sidecar file to be discovered and appended to a source schema during Fusion composition (CLI and Aspire), with new test resources and coverage verifying the behavior.
Changes:
- CLI: detect and ignore
*-extensions.graphql*during directory schema discovery, and append sidecar extensions content when present. - Aspire: when reading schema from project directory, also append the
*-extensions.graphql*sidecar file if it exists. - Tests/resources: add new SDL/settings/extension fixtures and new test cases validating composition output.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionCompositionHelpers.cs | Adds *-extensions sidecar detection, directory discovery filtering, and schema+extensions concatenation. |
| src/HotChocolate/Fusion/src/Fusion.Aspire/SchemaComposition.cs | Adds schema+extensions concatenation when reading schema from project directory. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionComposeCommandTests.cs | Adds CLI tests for composing with extensions (file + directory discovery) and updates resource setup helper. |
| src/HotChocolate/Fusion/test/Fusion.Composition.Tests/SchemaComposerTests.cs | Adds a composition unit test ensuring extensions are applied during composition. |
| src/Nitro/CommandLine/test/CommandLine.Tests/resources/valid-extensions/* | Adds new input schema/settings/extensions fixtures for CLI tests. |
| src/Nitro/CommandLine/test/CommandLine.Tests/resources/valid-extensions-result/composite-schema.graphqls | Adds expected composed composite schema snapshot for extensions scenario. |
Comments suppressed due to low confidence (1)
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionCompositionHelpers.cs:79
- When
--source-schema-filepoints directly to a*-extensions.graphql{s}sidecar, this branch treats it as the primary schema file and then looks for a non-existent*-extensions-settings.json, producing a confusing failure even if the base schema/settings exist. Consider detectingIsExtensionsFile(Path.GetFileName(schemaFilePath))here and either (a) rejecting with a dedicated, actionable ExitException message, or (b) resolving the corresponding base schema/settings file by stripping the-extensionssuffix.
else if (fileSystem.FileExists(sourceSchemaPath))
{
schemaFilePath = sourceSchemaPath;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Store the optional schema extensions sidecar as schema-extensions.graphqls inside both FusionArchive (per source schema) and FusionSourceSchemaArchive, instead of concatenating it into the base schema text. Threads ExtensionsSourceText end-to-end through composition, upload, publish, and the Aspire host, and removes a stale extensions entry when a re-composition supplies no sidecar.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- src/HotChocolate/Fusion/src/Fusion.Composition/Properties/CompositionResources.Designer.cs: Language not supported
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/HotChocolate/Fusion/src/Fusion.Composition/Properties/CompositionResources.Designer.cs: Language not supported
No description provided.