Skip to content

[Fusion] Support directive-definition deprecation and location - #10027

Merged
glen-84 merged 4 commits into
mainfrom
gai/directive-definition-introspection
Jul 1, 2026
Merged

[Fusion] Support directive-definition deprecation and location#10027
glen-84 merged 4 commits into
mainfrom
gai/directive-definition-introspection

Conversation

@glen-84

@glen-84 glen-84 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Fusion gateway introspection now reports the DIRECTIVE_DEFINITION directive location (added to the __DirectiveLocation enum, the location constants, and the __Directive.locations resolver), so a directive that targets directive definitions (for example @requiresOptIn) is introspected correctly instead of failing the resolver.
  • Adds directive-definition deprecation to the introspection surface, matching single-server HotChocolate: FusionDirectiveDefinition carries IsDeprecated/DeprecationReason (parsed from @deprecated), __Directive exposes isDeprecated/deprecationReason, and __Schema.directives honors includeDeprecated.
  • Deprecation is added via a new constructor overload; the original FusionDirectiveDefinition constructor is retained and marked [Obsolete] so existing callers keep compiling.

Test plan

  • Gateway introspection test: a directive whose locations include DIRECTIVE_DEFINITION is introspected with that location, and the isDeprecated/deprecationReason fields resolve for every directive.
  • Full Fusion.Execution.Tests passes (2308/0).

Copilot AI review requested due to automatic review settings July 1, 2026 11:24

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 support in Fusion gateway introspection for directive definitions that (1) target DIRECTIVE_DEFINITION and (2) participate in deprecation metadata, bringing Fusion’s introspection surface closer to single-server HotChocolate behavior.

Changes:

  • Extend introspection schema/resolvers to include DIRECTIVE_DEFINITION in __DirectiveLocation and handle it in __Directive.locations.
  • Add directive-definition deprecation metadata (isDeprecated/deprecationReason) to __Directive and honor includeDeprecated on __Schema.directives.
  • Extend FusionDirectiveDefinition to carry deprecation info (new ctor overload + [Obsolete] old ctor) and parse @deprecated on directive definitions during schema completion.

Reviewed changes

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

Show a summary per file
File Description
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Introspection/DirectiveDefinitionIntrospectionTests.cs Adds a gateway introspection test exercising DIRECTIVE_DEFINITION and new directive deprecation fields.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/__Schema.cs Updates __Schema.directives resolvers to support includeDeprecated filtering.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/__DirectiveLocation.cs Adds DIRECTIVE_DEFINITION enum string constant.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/__Directive.cs Exposes isDeprecated/deprecationReason and adds DIRECTIVE_DEFINITION location mapping.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs Adds deprecation properties and constructor overload; marks old ctor obsolete.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/IntrospectionSchema.cs Updates introspection SDL to add new fields/args and DIRECTIVE_DEFINITION.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaContext.cs Updates built-in directive definitions to use the new deprecation-aware constructor.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs Parses @deprecated on directive definitions and populates FusionDirectiveDefinition deprecation metadata.

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

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

77.2% of changed lines covered (61/79)

File Covered Changed Patch %
…/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs 12 22 54.5% 🔴
…/src/Fusion.Execution/Execution/Introspection/__Schema.cs 15 23 65.2% 🔴
…/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs 3 3 100.0% 🟢
…/Fusion.Execution.Types/Completion/CompositeSchemaContext.cs 8 8 100.0% 🟢
…/src/Fusion.Execution.Types/Completion/IntrospectionSchema.cs 8 8 100.0% 🟢
…/src/Fusion.Execution/Execution/Introspection/__Directive.cs 14 14 100.0% 🟢
…/Execution/Introspection/__DirectiveLocation.cs 1 1 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "71d150fdb269c1f48e58fe6fdedb56fcc49b83b0",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs", "ranges": [[26, 35]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/__Schema.cs", "ranges": [[117, 118], [122, 124], [145, 146], [156, 156]] }
  ]
}

Project coverage: 52.5% (217015/413212 lines)

@glen-84
glen-84 merged commit 6fb3496 into main Jul 1, 2026
282 of 284 checks passed
@glen-84
glen-84 deleted the gai/directive-definition-introspection branch July 1, 2026 13:00
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