Open filosganga opened 1 year ago
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?
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.