Add EnforceNullVariableValuesForMultipartFileUpload option - #9842
#9842Merged
tobias-tengler merged 2 commits intoJun 4, 2026
mainChilliCream/graphql-platform:mainfrom
tte/allow-non-null-upload-variable-valueChilliCream/graphql-platform:tte/allow-non-null-upload-variable-valueCopy head branch name to clipboard
Merged
Add EnforceNullVariableValuesForMultipartFileUpload option#9842tobias-tengler merged 2 commits intomainChilliCream/graphql-platform:mainfrom tte/allow-non-null-upload-variable-valueChilliCream/graphql-platform:tte/allow-non-null-upload-variable-valueCopy head branch name to clipboard
tobias-tengler merged 2 commits into
mainChilliCream/graphql-platform:mainfrom
tte/allow-non-null-upload-variable-valueChilliCream/graphql-platform:tte/allow-non-null-upload-variable-valueCopy head branch name to clipboard
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new GraphQLServerOptions.EnforceNullVariableValuesForMultipartFileUpload option to control whether multipart upload variable locations must contain null placeholders (strict spec behavior) or whether non-null placeholders are tolerated and replaced (lenient behavior).
Changes:
- Add
EnforceNullVariableValuesForMultipartFileUploadto server options (defaulttrue) and wire it into multipart variable rewriting. - Introduce a new multipart error (message + ThrowHelper) for non-null placeholders when strict enforcement is enabled.
- Add/extend tests in both AspNetCore and Fusion to cover strict vs lenient placeholder handling.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Primitives/src/Primitives/ErrorCodes.cs | Adds a new server error code for non-null multipart placeholders (currently collides with an existing code). |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FileUploadTests.cs | Adds Fusion gateway tests for strict vs lenient multipart placeholder behavior. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpMultipartMiddlewareTests.cs | Adds an AspNetCore middleware test asserting strict rejection for non-null placeholders. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpMultipartMiddlewareTests.Upload_File_In_InputObject_With_NonNull_Placeholder_Should_Be_Rejected.snap | Snapshot for the new strict-rejection middleware test. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Utilities/ThrowHelper.cs | Adds a dedicated ThrowHelper exception for the new strict enforcement error. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.resx | Adds the localized error message for non-null placeholder enforcement. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.Designer.cs | Adds the generated resource accessor for the new message. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Options/GraphQLServerOptions.cs | Adds the new enforcement option and includes it in Clone(). |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/HttpMultipartMiddleware.cs | Implements strict/lenient placeholder handling during variables rewrite. |
Files not reviewed (1)
- src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 5, 2026
This was referenced Jun 16, 2026
This was referenced Jun 26, 2026
This was referenced Jun 28, 2026
This was referenced Jul 5, 2026
This was referenced Jul 14, 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.