-
Notifications
You must be signed in to change notification settings - Fork 96
Description
Hello, when using a custom scalar that implements CustomIntScalar I get a validation error when a numeric variable is passed in the query. I have prepared a reproducer here:
https://github.com/mpuczynski55/smallrye-graphql-reproducer.git
The test class that demonstrates the problem is MovieResourceTest
The root cause seems to be VariablesParser that casts all numeric variables to BigDecimal by default. This behavior conflicts with the IntCoercing implementation used for CustomIntScalar that does not handle BigDecimal values. There does not appear to be a way to set NumberCoercing (which I believe should work in this case) for custom scalars, or at least I have not found how to do so.
Expected Behavior
The numeric value should be correctly parsed
Actual Behavior
The following error is returned:
{
"errors": [
{
"message": "Variable 'paginationParams' has an invalid value: SRGQL000013: Expected type [BigInteger or class extending class com.example.scalar.LongBigInteger] but was [BigDecimal].",
"locations": [
{
"line": 1,
"column": 8
}
],
"extensions": {
"classification": "ValidationError"
}
}
]
}
Environment:
- SmallRye GraphQL Version: 2.13.0
- Quarkus Version: 3.19.1
- Java 21