Repository navigation
Add DisableInternalDirectives option - #9651
Merged
tobias-tengler merged 2 commits intoMay 6, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.ExposeInternalDirectivesThroughSchemaRequestsand pass it through schema middleware/session/formatter layers. - Update
DefaultHttpResponseFormatterschema 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.
tobias-tengler
force-pushed
the
tte/add-option-to-expose-internal-directives
branch
from
May 6, 2026 12:31
345c83f to
aebdab4
Compare
This was referenced May 13, 2026
Closed
This was referenced Jun 16, 2026
This was referenced Jun 26, 2026
Closed
This was referenced Aug 31, 2026
This was referenced Sep 8, 2026
This was referenced Sep 17, 2026
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.