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

2.6.0 of springdoc-openapi-starter-webmvc-ui seems to introduce a regression when using @JsonUnwrapped & @Delegate #2682

Closed
NPE78 opened this issue Aug 21, 2024 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@NPE78
Copy link

NPE78 commented Aug 21, 2024

Describe the bug

We are using models encapsulated with @JsonUnwrapped and @Delegate (from lombok) instead of using regular extends (favor composition over inheritance).

Before version 2.6.0 of springdoc-openapi-starter-webmvc-ui, we were using 2.5.0 (we're using renovatebot to ensure we're at the latest versions).

All the fields from the delegated model are missing.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    3.3.2

  • What modules and versions of springdoc-openapi are you using?
    springdoc-openapi-starter-webmvc-ui (the one which has been upgraded from 2.5.0 to 2.6.0)

  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    Expected: it should use all the fields from the two objects
    Actual: only the fields from the parent object are in the openapi documentation

  • Provide with a sample code (HelloController) or Test that reproduces the problem

@Builder
@Jacksonized
public record AvailabilityDateRequest(LocalDate date,
                                      @JsonUnwrapped @Delegate AvailabilityRequest availabilityRequest) {

}
@Builder
@Jacksonized
public record AvailabilityRequest(List<String> data) {
}

Expected behavior

In this example, the generated documentation should contain date & data.
With 2.6.0, it contains only date

Screenshots
If applicable, add screenshots to help explain your problem.
N/A

Additional context
Add any other context about the problem here.

@wingsofovnia
Copy link

In my case, I was using @JsonUnwrapped in a Kotlin data class and the annotated field just disappeared from the schema. Reverting 2.5.0 fixes the issue.

@mtsfer
Copy link

mtsfer commented Sep 13, 2024

Apparently, it's not the combination of @JsonUnwrapped and @Delegate. @JsonUnwrapped by itself is not being presented on documentation anymore.

@bnasslahsen
Copy link
Collaborator

This is duplicate of #2640, which should resolved for the next release.

@bnasslahsen bnasslahsen added the duplicate This issue or pull request already exists label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants