Skip to content

Fix issue that parsed query for persisted operations#9523

Merged
michaelstaib merged 5 commits intomainfrom
mst/fix-transport-middleware
Apr 10, 2026
Merged

Fix issue that parsed query for persisted operations#9523
michaelstaib merged 5 commits intomainfrom
mst/fix-transport-middleware

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 10, 2026 10:53
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels Apr 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 skipDocumentBody flow through HTTP request parsing (DefaultHttpRequestParserUtf8GraphQLRequestParser) and surface “document body was present” via GraphQLRequest.HasDocumentBody.
  • Centralize “strict mode” enforcement in ExecutorSession based on PersistedOperationOptions (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.

Comment thread website/src/docs/fusion/v16/guides/first-party-api.md
Comment thread website/src/docs/fusion/v16/guides/first-party-api.md
Comment thread website/src/docs/fusion/v16/guides/first-party-api.md
Comment thread src/HotChocolate/Language/src/Language.Web/GraphQLRequest.cs
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