Reputation: 5647
I am using Swagger 2.0 for documentation generation. In my controller class, I have some operations like:
public Page<Employee> getEmployees(Pageable pageable) {....}
Swagger document generated for response of the operation above:
"responses" : {
"200" : {
"schema" : {
"$ref" : "#/definitions/Page"
}
}
}
Here, Swagger documentation failed to say that response is Page<Employee>
. How do I get generics data in documentation in Swagger?
And what if I have the following return types?
Page<String,Employee>
Page<Employee,List<Department>>
Page<Employee,Tuple.Two<String,User>>
Same is true for Swagger Operation parameters and Model properties.
Upvotes: 7
Views: 6620
Reputation: 3758
This is a known issue with Swagger, please check the following issue: https://github.com/OAI/OpenAPI-Specification/issues/957. Point being, you'll need to create your own extensions to describe generics.
Upvotes: 1