Kotlin data class not work without annotation
See original GitHub issueI try https://quarkus.io/guides/rest-json on kotlin. I want to use simple data class, without any annotation.
data class Fruit(
val name : String,
val description : String)
if I use quarkus-resteasy-jackson
(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
If I use quarkus-resteasy-jsonb
I get No default constructor found.
This is bad practice to use default constructor in this case.
related topic
<quarkus.platform.version>1.0.1.Final</quarkus.platform.version>
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (13 by maintainers)
Top Results From Across the Web
Data classes | Kotlin
Data classes cannot be abstract, open, sealed, or inner. Additionally, the generation of data class members follows these rules with regard to ...
Read more >kotlin data class with annotations, why @DateTimeFormat ...
you registered kotlin module, it allows you to apply jackson annotations to constructor params without targeting but it doesn't work for ...
Read more >Kotlin : Data Classes - Medium
The answer is yes, to make our work more easier Kotlin provides us the Data classes. These classes have all the functionalities of...
Read more >Data Classes in Kotlin - Baeldung
The Kotlin language has introduced the concept of Data Classes, whose main purpose is to simply hold data without the boilerplate code ...
Read more >kotlin data class with annotations, why @DateTimeFormat ...
you registered kotlin module, it allows you to apply jackson annotations to constructor params without targeting but it doesn't work for java validation ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So the reason why you aren’t seeing your
ObjectMapperCustomizer
run is because Quarkus believes thatObjectMapper
bean is not being used at all (see this for more details). This is a bug with Amazon Lamdba + Jackson integration which can be fixed very easily on our side (by making the bean unremovable like thequarkus-resteasy-jackson
already does), but I know that @patriot1burke is working on a lot of improvements that include this one as well.For now the workaround is to include
quarkus-resteasy-jackson
, but that won’t be needed once we fix the bug. Another potential workaround would be for you to injectObjectMapper
into one of your CDI beans (you don’t need to use it, just inject it via field or constructor injection).Thanks for reporting @miron4dev
Can you try with
quarkus-resteasy-jackson
and the Jackson kotlin module ?