招摇的@ApiResponses和@ApiResponses

时间:2017-04-12 11:45:34

标签: spring-boot swagger swagger-ui swagger-2.0

我注释了我的方法,

@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**/}

但在我虚张声势的用户界面中,我无法获得状态代码200及其消息。请解释原因? 以下图片是UI的快照, enter image description here

1 个答案:

答案 0 :(得分:2)

这是一个已知问题,看起来已修复3.0版。

在我看来,您可以在顶部看到响应结构,但在屏幕截图底部的表格中看不到它。

这也在这里提出,并在3.0版本中修复:

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

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