Skip to content

Add internal directive support to Fusion schema types - #10122

Merged
michaelstaib merged 2 commits into
mainfrom
fusion/internal-directives
Jul 17, 2026
Merged

Add internal directive support to Fusion schema types#10122
michaelstaib merged 2 commits into
mainfrom
fusion/internal-directives

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 17, 2026 14:26
@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

94.8% of changed lines covered (219/231)

File Covered Changed Patch %
…/Fusion/src/Fusion.Execution.Types/FusionDirective.cs 9 12 75.0% 🔴
…/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs 9 12 75.0% 🔴
…/Collections/FusionDirectiveCollection.cs 164 170 96.5% 🟡
…/src/Fusion.Execution.Types/Completion/CompletionTools.cs 8 8 100.0% 🟢
…/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs 27 27 100.0% 🟢
…/src/Fusion.Execution.Types/Directives/DirectiveTools.cs 2 2 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "bda4258f2e2f00b7d06cfcfb566b467eb411dc5d",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirective.cs", "ranges": [[25, 27]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs", "ranges": [[145, 147]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution.Types/Collections/FusionDirectiveCollection.cs", "ranges": [[85, 85], [351, 351], [388, 388], [405, 407]] }
  ]
}

Project coverage: 53.8% (231057/429810 lines)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class handling for “internal” directive applications in Fusion schema types, with special handling to normalize composed @fusion__tag into a public @tag directive definition while keeping tag applications optionally hidden from the default directive view.

Changes:

  • Normalize composed @fusion__tag directive definitions to @tag and map @fusion__tag applications to internal @tag applications during schema completion.
  • Introduce internal/public partitioning for FusionDirectiveCollection (default view shows only public directives; WithInternals exposes all).
  • Add test coverage for tag normalization/visibility and directive collection partition semantics.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Types/FusionTagDirectiveTests.cs Adds end-to-end tests validating tag normalization and internal/public visibility across schema elements.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Types/FusionDirectiveCollectionTests.cs Adds unit tests validating stable partitioning and API behavior for directive collections with internals.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs Adds support for directives applied to directive definitions and completion-time sealing.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirective.cs Adds per-application visibility (IsPublic) and constructor overload to support internal directives.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionBuiltIns.cs Adds fusion__tag built-in name constant.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Directives/DirectiveTools.cs Stops filtering out fusion__tag so it can be retained and normalized.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs Preserves/normalizes fusion__tag directive definitions into tag and completes directive-definition directives.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompletionTools.cs Maps fusion__tag applications to internal tag applications when building directive collections.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Collections/FusionDirectiveCollection.cs Implements public/internal partitioning, adds WithInternals view, and updates collection semantics accordingly.

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

Comment on lines +72 to +76
public IEnumerable<FusionDirective> AsEnumerable()
=> _publicCount == _directives.Length
? _directives
: EnumerateDirectives(_directives, _publicCount);

Comment on lines +14 to +18
[Fact]
public void Create_Should_LoadPrivateTagsAsInternalTagDirectives_When_UsingDefaultMergeBehavior()
{
var schema = ComposeAndLoadSchema();
var tagDefinition = schema.DirectiveDefinitions["tag"];
@michaelstaib
michaelstaib merged commit c920462 into main Jul 17, 2026
147 checks passed
@michaelstaib
michaelstaib deleted the fusion/internal-directives branch July 17, 2026 20:07
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