[Fusion] Support coercing number without decimals to Float#9491
Merged
tobias-tengler merged 3 commits intomainfrom Mar 31, 2026
Merged
[Fusion] Support coercing number without decimals to Float#9491tobias-tengler merged 3 commits intomainfrom
tobias-tengler merged 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates HotChocolate Fusion and the OpenAPI adapter to better handle GraphQL Float inputs provided as whole numbers (e.g., 500), aligning behavior across JSON variable coercion and HTTP query parameter parsing.
Changes:
- Allow
IntValueliterals to be treated as compatible when the target scalar expectsFloatin Fusion variable coercion. - Correct spec scalar serialization types in Fusion composite schema building (e.g.,
Float=>ScalarSerializationType.Float). - Add OpenAPI adapter coverage for
Floatquery parameters with and without decimals, and make numeric parsing culture-invariant.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/VariableCoercionTests.cs | Adds tests verifying Float variables accept whole numbers, 500.0, and fractional values. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionScalarTypeDefinition.cs | Treats IntValue literals as compatible when a scalar’s value kind includes Float. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaContext.cs | Assigns correct ScalarSerializationType for built-in spec scalars instead of always String. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/TestSchema.cs | Adds a query field used by new OpenAPI HTTP query parameter tests. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/HttpEndpointIntegrationTestBase.cs | Adds integration tests for Float query params (500 and 500.99). |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/snapshots/HttpEndpointIntegrationTestBase.Http_Get_With_Query_Parameter_Float_Value.snap | Snapshot for whole-number float query parameter case. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/snapshots/HttpEndpointIntegrationTestBase.Http_Get_With_Query_Parameter_Float_Value_With_Decimals.snap | Snapshot for decimal float query parameter case. |
| src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Execution/DynamicEndpointMiddleware.cs | Uses InvariantCulture when parsing int/double from query/route string values. |
💡 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.