Skip to content

Add DisableInternalDirectives option - #9651

Merged
tobias-tengler merged 2 commits into
mainfrom
tte/add-option-to-expose-internal-directives
May 6, 2026
Merged

tobias-tengler merged 2 commits into
mainfrom
tte/add-option-to-expose-internal-directives

Conversation

@tobias-tengler

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 6, 2026 11:41
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels May 6, 2026

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 a new server option to control whether internal directives (e.g. @authorize) are included in schema SDL responses served via the ASP.NET Core schema download endpoints, and documents how to opt back into the legacy behavior.

Changes:

  • Introduce GraphQLServerOptions.ExposeInternalDirectivesThroughSchemaRequests and pass it through schema middleware/session/formatter layers.
  • Update DefaultHttpResponseFormatter schema caching to vary by (schemaName, includeInternalDirectives) so cached SDL matches the requested behavior.
  • Add snapshot-based tests and migration documentation for the new option.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md Adds migration guidance describing internal directives no longer being exposed by default and how to opt in.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSemanticNonNullSchemaMiddlewareTests.cs Adds test covering internal-directive inclusion when the new option is enabled (semantic-non-null endpoint).
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs Adds test covering internal-directive inclusion when the new option is enabled (schema endpoint).
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSemanticNonNullSchemaMiddlewareTests.Download_GraphQL_SemanticNonNull_Schema_Outputs_Internal_Directives_When_ExposeInternalDirectivesThroughSchemaRequests_Is_True.snap Snapshot for the new semantic-non-null opt-in behavior.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_Schema_Outputs_Internal_Directives_When_ExposeInternalDirectivesThroughSchemaRequests_Is_True.snap Snapshot for the new schema opt-in behavior.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSemanticNonNullSchemaMiddlewareTests.Download_GraphQL_SemanticNonNull_Schema_Outputs_Internal_Directives_When_ExposeInternalDirectives_Is_True.snap Adds an additional snapshot file (currently appears unused/orphaned).
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_Schema_Outputs_Internal_Directives_When_ExposeInternalDirectives_Is_True.snap Adds an additional snapshot file (currently appears unused/orphaned).
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Options/GraphQLServerOptions.cs Adds the new configuration option and ensures it’s copied in Clone().
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpGetSemanticNonNullSchemaMiddleware.cs Threads the option into schema writing for the semantic-non-null endpoint.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpGetSchemaMiddleware.cs Threads the option into schema writing for schema endpoint responses.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/ExecutorSession.cs Extends schema-writing APIs to accept an includeInternalDirectives flag.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Formatters/IHttpResponseFormatter.cs Extends the public formatter interface with an includeInternalDirectives parameter for schema formatting.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Formatters/DefaultHttpResponseFormatter.cs Implements directive inclusion + updates schema output caching keys to incorporate the new flag.

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

Comment thread src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpGetSchemaMiddleware.cs Outdated
@tobias-tengler
tobias-tengler force-pushed the tte/add-option-to-expose-internal-directives branch from 345c83f to aebdab4 Compare May 6, 2026 12:31
@tobias-tengler tobias-tengler changed the title Add ExposeInternalDirectivesThroughSchemaRequests option Add DisableInternalDirectives option May 6, 2026
@tobias-tengler
tobias-tengler requested a review from Copilot May 6, 2026 12:34

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

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

@tobias-tengler
tobias-tengler merged commit 4e349d1 into main May 6, 2026
137 of 139 checks passed
@tobias-tengler
tobias-tengler deleted the tte/add-option-to-expose-internal-directives branch May 6, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants