[英]How to annotate Page<Foo> for generate correct response
RestController 返回响应
Page<Foo>
我这样注释
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
array = @ArraySchema(
schema = @Schema(implementation = Foo.class)
)),
description = "The request has succeeded")
但我需要生成页面而不是数组。
有什么办法可以做到这一点
如果应该是这样的
schema PageFoo->data-> [{Foo}]
如果我删除注释,它将生成正确的模式但没有内容类型
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PageFoo.class)
),
description = "The request has succeeded"
)
})
class PageFoo {
@Schema(name = "data", implementation = Foo.class, type = SchemaType.ARRAY)
List<Foo> data;
//...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.