Joe*_*587 5 swagger spring-boot springfox
我试图将自定义容器显示为大胆的成功响应。我无法为此描述所需的模型
@ApiResponse (code = 200, message = "Successfully retrieved report info", response = PagedResponse.class
Run Code Online (Sandbox Code Playgroud)
这是PagedResponseInfo实际上是一个自定义集合
public class PagedResponse<T> {
private long page;
private long pageSize;
private long totalRecords;
private List<T> records;
}
Run Code Online (Sandbox Code Playgroud)
如果要在其中包含Report对象的集合,该如何指定容器?有人可以帮我吗?我在春季启动时使用springfox swagger -2.9.2
您需要responseContainer在@ApiResponse注释中定义该属性。
Run Code Online (Sandbox Code Playgroud)/** * Declares a container wrapping the response. * <p> * Valid values are "List", "Set" or "Map". Any other value will be ignored. */ String responseContainer() default "";
价值List就是您正在寻找的东西。它将把你包裹PagedResponse<ReportInfo>在一个容器中。
@ApiResponse(
code = 200,
message = "Successfully retrieved report info",
response = PagedResponse.class,
responseContainer = "List")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
229 次 |
| 最近记录: |