Skip to content

@JsonUnwrapped is ignored in new version of lib #2856

Closed
@skyfall174

Description

@skyfall174

Describe the bug
Hi evryone!
I am upgrading from spring boot 3.2 to 3.4.1 and I have some troubles with @JsonUnwrapped

For example I provide a simple spring boot project with 2 records.

public record Example(
        @JsonUnwrapped
        @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
        Wrapped unwrapped,

        @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Some description")
        Integer number
) {
    public record Wrapped(
            @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Some description")
            String value
    ) {
    }
}

After a generation of definitions, value is missing.

To Reproduce
Steps to reproduce the behavior:

Here is the project with this bug: unwrapped-test.zip

  • What version of spring-boot you are using? -> 3.4.1
  • What modules and versions of springdoc-openapi are you using? -> 2.8.3
  • What is the actual and the expected result using OpenAPI Description (yml or json)?

Actual result is:

{
"org.mkl.unwrappedtest.dto.Example": {
  "required": [
    "number"
  ],
  "type": "object",
  "properties": {
    "number": {
      "type": "integer",
      "description": "Some description",
      "format": "int32"
    }
  }
}
}

Expected behavior

{
  "org.mkl.unwrappedtest.dto.Example": {
    "required": [
      "number"
    ],
    "type": "object",
    "properties": {
      "number": {
        "type": "integer",
        "description": "Some description",
        "format": "int32"
      },
      "value": {
        "type": "integer",
        "description": "Some description value",
        "format": "int32"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions