Fix issue that parsed query for persisted operations#9523
Merged
michaelstaib merged 5 commits intomainfrom Apr 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates HotChocolate’s ASP.NET Core request parsing to support a “strict trusted documents” mode where GraphQL document bodies (query) are intentionally skipped (so the parser/validator never sees untrusted operation text), and expands the Fusion docs to describe a first‑party persisted-operations workflow.
Changes:
- Add a
skipDocumentBodyflow through HTTP request parsing (DefaultHttpRequestParser→Utf8GraphQLRequestParser) and surface “document body was present” viaGraphQLRequest.HasDocumentBody. - Centralize “strict mode” enforcement in
ExecutorSessionbased onPersistedOperationOptions(OnlyAllowPersistedDocuments=true+AllowDocumentBody=false). - Replace the draft Fusion guide with a full trusted-documents / persisted-operations guide and update tests/config samples accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/docs/fusion/v16/guides/first-party-api.md | New first‑party/persisted-ops guide; includes strict-mode configuration and dev workflow examples. |
| src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.cs | Adds skipDocumentBody option to skip reading query and track presence. |
| src/HotChocolate/Language/src/Language.Web/GraphQLRequest.cs | Adds HasDocumentBody to represent presence of a document body (parsed or skipped). |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Parsers/IHttpRequestParser.cs | Extends parsing APIs with skipDocumentBody. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Parsers/DefaultHttpRequestParser.cs | Wires skipDocumentBody into JSON/body and GET-param parsing. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/ExecutorSession.cs | Determines strict mode from persisted-op options and enforces “no document body” behavior. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Utilities/MiddlewareHelper.cs | Routes parsing/formatting through ExecutorSession convenience methods. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpPostMiddlewareBase.cs | Uses ExecutorSession.ParseRequestAsync wrapper. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpMultipartMiddleware.cs | Uses ExecutorSession.ParseRequest wrapper. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HotChocolate.AspNetCore.Pipeline.csproj | Adds reference to persisted operations abstractions for options/error. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Serialization/DefaultHttpRequestParserTests.cs | Updates calls for new parser signature. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/PersistedOperationTests.cs | Adjusts test configuration to explicitly allow document bodies where required. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 1, 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.