quarkus: Kotlin data class not work without annotation

I 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>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (13 by maintainers)

Commits related to this issue

Most upvoted comments

So the reason why you aren’t seeing your ObjectMapperCustomizer run is because Quarkus believes that ObjectMapper 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 the quarkus-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 inject ObjectMapper 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 ?

<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-module-kotlin</artifactId>
</dependency>