从春季休息服务中,我返回的回复是-

return new ResponseEntity<ExampleOutputData>(exampleService.exampleServiceCall(inputData), responseHeaders, HttpStatus.ACCEPTED);


我在注释中提到的回应是-

 @ApiResponses(value = {
            @ApiResponse(code = 202, message = "Success", response = ResponseEntity.class)})


我收到yaml doc回应为-

  responses:
    202:
      description: "Success"
      schema:
        $ref: "#/definitions/ResponseEntity"


我的问题是我如何在响应中提及ExampleOutputData,因为我的响应实际上是ResponseEntity<ExampleOutputData>

还是不是必需的,并且当前的实现和灵活的定义是完美的?

最佳答案

为了在响应中包含ExampleOutputData,您只需将ResponseEntity.class更改为ExampleOutputData.class

@ApiResponses(value = {@ApiResponse(code = 202, message = "Success", response = ExampleOutputData.class)})


请参阅文档here

10-06 05:32