For example there are two classes with same name Group in different packages. But when referring to models in swagger ui only one model is being shown and even the response mapping is not proper, swagger is incorrectly referring to these models.
swagger 2.0 - how to solve same response class names in different packages issue in spring boot application
Asked Answered
One workaround is using @ApiModel on both the models. Is there any better solution. –
Poisonous
Did you find a solution to this problem? –
Fairspoken
Yes. Adding the below property solves this issue.
springdoc.use-fqn=true
But after adding this, the schemas in swagger ui start showing up with the complete package name. To avoid this try annotating your model classes with:
@Schema(name = "class name to be displayed")
I meet the same problem today with springdoc-openapi-ui:1.5.9, and maybe solved it.
Simply add key-value pairs to application.properties.
springdoc.use-fqn=true
Then org.springdoc.core.SpringDocConfigProperties read this value, and pass it to io.swagger.v3.core.jackson.TypeNameResolver.
© 2022 - 2024 — McMap. All rights reserved.