Skip to content

Annotation @JsonUnwrapped generates empty field #2811

Closed
@Murasj

Description

@Murasj

Hi,
this bug was noticed since 2.6.0 and still exists in 2.7.0 and block update SpringBoot in my app to version 3.4.0. Problem is that I have classes like below:

@Data
public class PreferenceData {

    @Schema(
        description = "Title",
        example = "My Title"
    )
    @NotBlank
    private String title;

    @NotNull
    @Valid
    private PreferenceConfigData config;
....
@Data
public class PreferenceConfigData {

    @JsonUnwrapped
    private PreferenceConfigSection preferenceConfigSection;

}
@Data
public class PreferenceConfigSection {
//some @NotNull and @NotBlank fields
}

Finally in generated json field config is empty, it doesn't contain any fields from DashboardConfigSection.
I've tried some suggestions like
SpringDocUtils.getConfig().addParentType
or disabling springdoc.model-converters.polymorphic-converter.enabled but any of it resolve my issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions