[Fusion] Add support for source schema extensions#9621
Draft
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.