Is there any way to use `value class`es with jacks...
# jackson-kotlin
d
Is there any way to use `value class`es with jackson? (Especially with Micronaut...)
w
The experimental project I am creating covers some use cases (but I have not confirmed that it will work with
Micronaut
). https://github.com/ProjectMapK/jackson-module-kogera However, please note that perfect support is not possible unless
Kotlin
provides the functionality for compatibility. See also the following issue. https://github.com/FasterXML/jackson-module-kotlin/issues/650
d
It would have been nice if one of there adapters would just use KSP to generate what's needed instead of reflection or kotlin metadata... then even the value class problems wouldn't exist... Micronaut generates some kind of classes to avoid reflection too (with the
@Introspected
annotation), but obviously they don't really support Kotlin too much... since it's mostly java.
But at least somebody's trying 😃! Just "expiremental project" is a bit scary to be using for production.
w
KSP
Perfect support for
value class
is unrealistic as far as
Jackson
is concerned. The main reason is that the code generated by
value class
will interfere with the analysis by
Jackson
.
Just "expiremental project" is a bit scary to be using for production.
Yes, I do not recommend using this project for production code. However, the results obtained by this project will be reflected in
jackson-module-kotlin
and
Kotlin
, so active experimentation would be greatly appreciated.
d
Is the issue just reading? In my experience writing value classes is working just fine
w
This is not to say that there are no issues in serialization. Compared to deserialization, it works correctly in many cases, but there are a few issues that are difficult to fix.