Issue with displaying generics model and return type in Swagger UI
Describe the bug
We are having issues on displaying generics model as a return type for our controller in Swagger UI. Instead of showing GenericModel
To Reproduce Steps to reproduce the behavior:
- Currently using spring boot 2.2.6 with Java 11
- springdoc-openapi-ui version 1.3.0
Given this generic model:
public class BaseApiResponse<T> {
private T data;
private List<Error> errors = new ArrayList();
private List<Message> messages = new ArrayList();
}
When we are returning the following type in our controller:
public ResponseEntity<BaseApiResponse<Account>> get(@PathVariable Long id) throws ResourceNotFoundException {
}
The schema created in the Swagger UI and API-docs for the return type is:
BaseApiResponseAccount instead of BaseApiResponse
Expected behavior
We should expect similar behaviour as in Springfox (http://springfox.github.io/springfox/docs/snapshot/#changing-how-generic-types-are-named), where Swagger UI should either display BaseApiResponse
@tonjack,
This is not an issue on springxdoc-openapi. We only rely on standard OpenAPI 3 and official swagger jars. The generated OpenAPI description is Valid.
The behaviour you are expecting, is not supported natively, by the API. There is already an Open issue on swagger-core that you can follow, similar to the behaviour you are expecting:
- https://github.com/swagger-api/swagger-core/issues/3323