From my spring rest service, I am returning response as -
return new ResponseEntity<ExampleOutputData>(exampleService.exampleServiceCall(inputData), responseHeaders, HttpStatus.ACCEPTED);
And I am mentioning response in annotaion as -
@ApiResponses(value = {
@ApiResponse(code = 202, message = "Success", response = ResponseEntity.class)})
And I am getting yaml doc response as -
responses:
202:
description: "Success"
schema:
$ref: "#/definitions/ResponseEntity"
My question is how do I mention ExampleOutputData in the response as actually my response is ResponseEntity<ExampleOutputData>
Or is it not required and the current implementation and swagger definition is perfect?
In order to have ExampleOutputData in the response you should simply change
ResponseEntity.class
toExampleOutputData.class
:See documentation here.