You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to version 2.6.0 of springdoc-openapi we have found that properties included via @JsonUnwrapped aren’t present in the generated model schema.
We assume that the PolymorphicModelConverter causes the problem, since if we disable the polymorphic converter, the generated model looks like expected.
To Reproduce
Spring-Boot: v3.3.1
Spring Doc OpenAPI Packages:
springdoc-openapi-starter-webmvc-ui v2.6.0
Create a model including properties annotated with @JsonUnwrapped
set springdoc.model-converters.polymorphic-converter.enabled=true
The model generated by the example project doesn't include the properties of the @JsonUnwrapped annotated property:
Disabling the polymorphic converter is a possibility, but another less intrusive solution is to manually specify the classes that contains @JsonUnwrapped fields in the SpringDocUtils#addParentType method. This way the polymorphic converter should still work fine.
For example taking as a reference your attached project @andreasbannachdmde this is how it's done :
A project that I'm working on is affected by this bug as well. We use @JsonUnwrapped quite a lot to have less code duplication between DTOs, and this breaks our openapi specs with 2.6.0. I tried the SpringDocUtils.getConfig().addParentType() workaround, but strangely it did not work in our project. For now I've reverted to SpringDoc version 2.5.0 and that one works fine. I did notice that the description fields have also disappeared from DTO openapi specs (the ones that are gathered by therapi from the JavaDoc in the DTOs) but that is likely a different bug; that also worked fine in pre 2.x versions of SpringDoc. Regardless, thanks for working on this project, we really like using it ❤️
Describe the bug
After upgrading to version 2.6.0 of springdoc-openapi we have found that properties included via @JsonUnwrapped aren’t present in the generated model schema.
We assume that the PolymorphicModelConverter causes the problem, since if we disable the polymorphic converter, the generated model looks like expected.
To Reproduce
The model generated by the example project doesn't include the properties of the @JsonUnwrapped annotated property:
Example project: springdoc-json-unwrapped-ignored.zip
Expected behavior
The expected schema should include all properties including those of the unwrapped property:
The text was updated successfully, but these errors were encountered: