Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@JsonUnwrapped is ignored in new version of lib #2856

Closed
skyfall174 opened this issue Jan 14, 2025 · 3 comments
Closed

@JsonUnwrapped is ignored in new version of lib #2856

skyfall174 opened this issue Jan 14, 2025 · 3 comments

Comments

@skyfall174
Copy link

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"
      }
    }
  }
}
@skyfall174
Copy link
Author

Hello, @bnasslahsen
Thanks you for quick fix, but this is still not working for

springdoc.use-fqn = true

When fqn is false - this works fine

I try it in example project with latest snapshot version 2.8.4-20250114.194708-3

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Jan 15, 2025

@skyfall174,

These tests are passing as expected.
But you feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem. (Link to minimal project in Github) - if you believe the issue is still there.

@skyfall174
Copy link
Author

@bnasslahsen - Apologies for the confusion! Your commit has resolved the issue perfectly. It turns out the problem was on our side.

Thank you for your help! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants