Virat
Virat

Reputation: 581

@ApiResponses and @ApiResponses in swagger

I have annotated my method like,

@ApiOperation( value = "Get time spent on category", response = CategoryBean.class, responseContainer = "List", notes = "API to get the time spent on all tasks based on category" )
@ApiImplicitParams( {
        @ApiImplicitParam( name = "x-auth-token", value = "", dataType = "string", required = true, paramType = "header" ) } )
@ApiResponses( value = {
        @ApiResponse( code = 200, message = "Success", response = CategoryBean.class, responseContainer = "List" ) } )
@RequestMapping( value = "/getTimeSpentOnCategory", method = RequestMethod.POST )
public ResponseEntity<?> getTimeSpentOnCategory( @RequestBody DashboardTaskRequestBean bean )
{/**some operation**/}

But in my swagger UI, I'am not able to get the Status code 200 and its message. Please explain why? The following picture is the snapshot of the UI, enter image description here

Upvotes: 2

Views: 25952

Answers (1)

gaganbm
gaganbm

Reputation: 2843

This is a known issue and looks like it is fixed with version 3.0.

As I see it, you are able to see the response structure at the top, but it is not visible in the table at the bottom of the screenshot.

This is also raised here and is fixed with version 3.0 :

https://github.com/swagger-api/swagger-ui/issues/1505

https://github.com/swagger-api/swagger-ui/issues/1297

Upvotes: 4

Related Questions