Open milindsingh opened 1 year ago
This is an issue of the ObjectMapper used by springdoc.
The SDK adds the ApiModule to the ObjectMapper used for De-/Serialization. This includes a ReviewMixin class which helps correctly deserializing the review object.
You may have to investigate how to customize the modelconverters or objectmapper used by springdoc. One option could be to use the replaceWithSchema
or replaceWithClass
method as described here https://springdoc.org/#how-can-i-use-enable-springdoc-openapi-monetaryamount-support (use only of the config methods mentioned below)
interface CustomReview {
// ... add necessary properties and jackson annotations
}
static {
SpringDocUtils.getConfig()
.replaceWithClass(
com.commercetools.api.models.review.Review.class,
CustomReview.class
)
.replaceWithSchema(
com.commercetools.api.models.review.Review.class,
new ObjectSchema()
.addProperty(
"target",
new ComposedSchema()
.addOneOfItem(new ObjectSchema().$ref("CategoryReview"))
.addOneOfItem(new ObjectSchema().$ref("ProductReview"))
)
// ... add the other properties for review class
);
}
I also saw other code snippets which were more sophisticated but may be harder to adapt to your needs.
Describe the bug Springdoc open api spec fails
To Reproduce Setup spring app with springdoc
Expected behavior no error
Screenshots/Code snippet
Stack information (please complete the following information):
Additional context remove
void setTarget(Object var1)
incom.commercetools.api.models.review.Review
?