Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Fusion] Coerce single element value for list variable - #9750

#9750
Merged
tobias-tengler merged 1 commit into
mainChilliCream/graphql-platform:mainfrom
tte/fix-fusion-variable-coercionChilliCream/graphql-platform:tte/fix-fusion-variable-coercionCopy head branch name to clipboard
May 20, 2026
Merged

[Fusion] Coerce single element value for list variable#9750
tobias-tengler merged 1 commit into
mainChilliCream/graphql-platform:mainfrom
tte/fix-fusion-variable-coercionChilliCream/graphql-platform:tte/fix-fusion-variable-coercionCopy head branch name to clipboard

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented May 20, 2026

Copy link
Copy Markdown
Member

Closes #9749

Copilot AI review requested due to automatic review settings May 20, 2026 10:40

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

This PR updates Fusion’s JSON variable coercion to follow the GraphQL spec’s List Input Coercion rule by allowing a non-list JSON value to be treated as a single-element list when the variable type is a list (fixing the behavior reported in #9749).

Changes:

  • Update Fusion list-variable coercion to wrap non-array JSON values into a single-item ListValueNode.
  • Add Fusion tests covering single-value-to-list coercion and related error cases.
  • Add a matching core execution test asserting the error shape when a single value cannot be coerced to the list element type.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/JsonVariableCoercion.cs Implements single-value → single-item-list coercion for list-typed variables.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/VariableCoercionHelperTests.cs Adds Fusion test coverage for list coercion and error reporting.
src/HotChocolate/Core/test/Execution.Tests/Processing/VariableCoercionHelperTests.cs Adds core test coverage for the error produced when the single value doesn’t match the list element type.

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

@tobias-tengler
tobias-tengler merged commit c0a4a9e into main May 20, 2026
139 checks passed
@tobias-tengler
tobias-tengler deleted the tte/fix-fusion-variable-coercion branch May 20, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fusion doesn't automatically coerce single values into lists for variables

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.