-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The custom scalars do not parse underlying model #991
Comments
Thanks for the very detailed report 💯 |
I'll be totally honest with you: I'm not very familiar with this part of the code. Would you be ready to making a PR for that? If possible, it'd be great to cover that with some tests. |
Thank you, I will definitely make a PR |
filosganga
added a commit
to filosganga/sangria
that referenced
this issue
Apr 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I am playing with the custom scalars, and I have found something weird. Assuming I have a scalar like this one:
And a schema like so:
When the
FutureResolver
tries to resolve the birthday value, it fail with ClassCastException because the Scalar coerceOutput expects a LocalData, however, under the hood our model is Json.Then I notice the
extractScalar
function isResolverBasedAstSchemaBuilder
:That in my opinion should use
coerceInput
orcoerceUserInput
of the scalar before returning the coerced (that is not really coerced). As this is what it does with the other built-in types: it returns Long, BigInt, BigDecimal and so on, while in case of a custom scalar, returns the value taken from theInputUnmarshaller
as-isI have tried changing the last case like this:
And does the trick, however, I am not sure if it should really use
coerceInput
insteadMaking the above change, all the tests are green 🟢
The text was updated successfully, but these errors were encountered: