Skip to content

Add appliedDirectives to __Directive introspection - #10143

Merged
glen-84 merged 1 commit into
mainfrom
gai/directive-applied-directives-introspection
Jul 23, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/directive-applied-directives-introspection

Conversation

@glen-84

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

Copy link
Copy Markdown
Member

Summary

  • Adds an appliedDirectives: [__AppliedDirective!]! field to the __Directive introspection type, gated behind the EnableDirectiveIntrospection schema option, so directives applied to a directive definition become introspectable.
  • Mirrors the existing appliedDirectives implementations on __Type, __Field, and __Schema. Stays out of standard introspection because __AppliedDirective is a non-spec Hot Chocolate extension.

Test plan

  • New IntrospectionTests.AppliedDirectivesOnDirectiveDefinitionAreExposed: a directive definition carrying an applied directive round-trips through __schema { directives { appliedDirectives { name args { name value } } } }.
  • Full IntrospectionTests suite green (net10.0); regenerated the four directive-introspection snapshots that enumerate every type's fields.

Copilot AI review requested due to automatic review settings July 23, 2026 08:39

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

This PR extends Hot Chocolate’s (non-spec) directive introspection support by adding appliedDirectives: [__AppliedDirective!]! to the __Directive introspection type, gated behind EnableDirectiveIntrospection, so directives applied to directive definitions can be introspected consistently with __Type, __Field, and __Schema.

Changes:

  • Added appliedDirectives field to __Directive when EnableDirectiveIntrospection is enabled, resolving to the directive definition’s applied directives.
  • Added a new regression test asserting applied directives on directive definitions round-trip through __schema { directives { appliedDirectives ... } }.
  • Updated directive-introspection snapshots to account for the new __Directive.appliedDirectives field (and added a new snapshot for the new test).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/HotChocolate/Core/src/Types/Types/Introspection/__Directive.cs Adds the gated appliedDirectives field to __Directive and resolves it from the directive definition’s applied directives, filtering to public directives like other applied-directive introspection resolvers.
src/HotChocolate/Core/test/Execution.Tests/IntrospectionTests.cs Adds a test verifying applied directives on directive definitions are exposed when directive introspection is enabled.
src/HotChocolate/Core/test/Execution.Tests/__snapshots__/IntrospectionTests.DirectiveIntrospection_SomeDirectives_Internal.snap Snapshot update reflecting the new __Directive.appliedDirectives field in directive introspection output.
src/HotChocolate/Core/test/Execution.Tests/__snapshots__/IntrospectionTests.DirectiveIntrospection_AllDirectives_Public.snap Snapshot update reflecting the new __Directive.appliedDirectives field.
src/HotChocolate/Core/test/Execution.Tests/__snapshots__/IntrospectionTests.DirectiveIntrospection_AllDirectives_Public_When_DisableInternalDirectives_Is_True.snap Snapshot update reflecting the new __Directive.appliedDirectives field.
src/HotChocolate/Core/test/Execution.Tests/__snapshots__/IntrospectionTests.DirectiveIntrospection_AllDirectives_Internal.snap Snapshot update reflecting the new __Directive.appliedDirectives field.
src/HotChocolate/Core/test/Execution.Tests/__snapshots__/IntrospectionTests.AppliedDirectivesOnDirectiveDefinitionAreExposed.snap New snapshot for the new regression test.

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

@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (11/11)

File Covered Changed Patch %
…/Core/src/Types/Types/Introspection/__Directive.cs 11 11 100.0% 🟢

Project coverage: 53.8% (231700/430550 lines)

@glen-84
glen-84 merged commit 5334d14 into main Jul 23, 2026
148 checks passed
@glen-84
glen-84 deleted the gai/directive-applied-directives-introspection branch July 23, 2026 09:08
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