在swagger注释中具有参数化类的java
从我的春季休息服务中,我回复如下-
return new ResponseEntity<ExampleOutputData>(exampleService.exampleServiceCall(inputData), responseHeaders, HttpStatus.ACCEPTED);
我在注释中提到的回应是——
@ApiResponses(value = {
@ApiResponse(code = 202, message = "Success", response = ResponseEntity.class)})
我收到的yaml文件回复为-
responses:
202:
description: "Success"
schema:
$ref: "#/definitions/ResponseEntity"
我的问题是如何在响应中提到ExampleOutputData,因为实际上我的响应是ResponseEntity<ExampleOutputData>
或者它不是必需的,并且当前的实现和招摇过市的定义是完美的
# 1 楼答案
为了在响应中包含ExampleOutputData,您只需将
ResponseEntity.class
更改为ExampleOutputData.class
:见文件here