Skip to content

@JsonUnwrapped is still broken since 2.5 #2879

@wingsofovnia

Description

@wingsofovnia

Describe the bug

Since @JsonUnwrapped has been broken in 2.6.0 I still not able to make @JsonUnwrapped work with my Kotlin data classes despite numerous fixes:

To Reproduce

data class ContactCreateRequest(
    @JsonUnwrapped
    val person: Person,

    @Schema(required = false)
    @JsonProperty("labels", required = false)
    val labels: List<String>? = null,
)

data class Person(
    @Schema(required = true, example = "Oscar Claude Monet")
    @JsonProperty("name", required = true)
    val name: String,

    @Schema(example = "+38051231412")
    @JsonProperty("phone")
    val phone: String? = null,

    @Schema(required = true, example = "oscar.monet@lafrance.fr")
    @JsonProperty(value = "email", required = true)
    val email: String,
)

This example in a sample Spring Boot project:

Dependencies

  • Kotlin 2.1.10
  • org.springdoc:springdoc-openapi-starter-webmvc-api:2.8.4
  • org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.4
  • org.springframework.boot:spring-boot-....:3.4.2

Expected Behavior (v2.5.0)
Image

Actual Behavior (v2.8.4)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions