You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to use java.time.Year in browser callable services, and possibly other time types as well. Many business applications work with time in various ways and so it would make sense to support this in Hilla as well.
Without any custom configuration, Jackson serializes Year as a string. Hilla is able to read this as well. However, the model type is ObjectModel and the DTO type is unknown. This causes problems with form binding; the default empty value is [object Object] and not an empty string.
Describe the solution you'd like
A quick and dirty solution would be to just hard code support for java.time.Year and other built-in Java types that one could assume are used in browser callable services.
A more flexible solution would be an API for customizing the code generator. Just as you have to create a custom serializer and deserializer to instruct Jackson to treat Year as an integer, you could create a custom converter that instructs the Hilla code generator how to treat Year.
Describe alternatives you've considered
You could just use an integer or string in your DTO and handle the conversion inside the browser callable service. However, this goes agains the principle of being able to use the same backend in both Flow and Hilla.
This turns the browser callable services into adapters - yet another abstraction layer in front of the actual application services.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Regarding the API for customizing the code generator, one solution would be better exposure for the Jackson mapper that we use in both code generation and runtime.
For now let us go with hard-coded java.time.Year support.
java.time.YearMonth would be useful, as would java.time.Period and java.time.Duration. I assume LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime, and Instant are already supported.
Describe your motivation
I'd like to be able to use
java.time.Year
in browser callable services, and possibly other time types as well. Many business applications work with time in various ways and so it would make sense to support this in Hilla as well.Without any custom configuration, Jackson serializes
Year
as a string. Hilla is able to read this as well. However, the model type isObjectModel
and the DTO type isunknown
. This causes problems with form binding; the default empty value is[object Object]
and not an empty string.Describe the solution you'd like
A quick and dirty solution would be to just hard code support for
java.time.Year
and other built-in Java types that one could assume are used in browser callable services.A more flexible solution would be an API for customizing the code generator. Just as you have to create a custom serializer and deserializer to instruct Jackson to treat
Year
as an integer, you could create a custom converter that instructs the Hilla code generator how to treatYear
.Describe alternatives you've considered
You could just use an integer or string in your DTO and handle the conversion inside the browser callable service. However, this goes agains the principle of being able to use the same backend in both Flow and Hilla.
This turns the browser callable services into adapters - yet another abstraction layer in front of the actual application services.
Additional context
No response
The text was updated successfully, but these errors were encountered: