-
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
It is impossible to override an built-in scalar #1000
Comments
filosganga
added a commit
to filosganga/sangria
that referenced
this issue
May 16, 2023
filosganga
added a commit
to filosganga/sangria
that referenced
this issue
May 16, 2023
filosganga
added a commit
to filosganga/sangria
that referenced
this issue
May 16, 2023
We're using custom scalars like: implicit val UUIDType: ScalarAlias[UUID, String] = ScalarAlias[UUID, String](
StringType,
toScalar = _.toString,
fromScalar = idString =>
try Right(UUID.fromString(idString))
catch {
case _: IllegalArgumentException => Left(IDViolation)
}) Have you tried that approach? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sangria comes with a set of built-in scalar.
However, sometime the builtin implementation does not fit the requirements, for example, some people would like to represent a BigDecimal always as string.
If the user defines a custom scalar with the same name of a builtin, it is ignored rather than override the builtin one.
I think it should be good instead to allow overriding the builtin scalars and use them only as fallback.
The text was updated successfully, but these errors were encountered: