【问题标题】:Personnalize route format - Swagger with Play Framework个性化路线格式 - Swagger with Play Framework
【发布时间】:2015-04-28 15:09:55
【问题描述】:

我正在使用 Play Framework 开发一个带有 Swagger UI 的 API。

但我遇到了一个小问题(不是大问题): 我的网址是:

https://url/find?param1=false&&&param4=1

但是当没有给出参数时我有'&&'(我的意思是param2和param3) 我想要的只是:

https://url/find?param1=false&param4=1

这里是: 我的控制器:

@Api(value = "url", description = "...")
public class nameClassApiController extends ApiController {

@ApiOperation(value = "...", notes = "...", response = nameClass.class, httpMethod = "GET")
@ApiResponses(value = { @ApiResponse(code = 200, message = "success"), @ApiResponse(code = 500, message = "error", response = ApiError.class) })


public static Result getList(
@ApiParam(value = "param1", required = false) @QueryParam("param1") Long param1,
@ApiParam(value = "param2", required = false) @QueryParam("param2") Long param2, ....) {

return getJsonSuccessResponse(className.getList(param1, param2, ...));

}

还有我的路线定义:

GET  url/find  className.getList(param1: java.lang.Long ?= null, param2: java.lang.Long ?= null, param3: java.lang.Long ?= null, param4: java.lang.Long ?= null)

注意:参数是可选的,所以在我的路由中,我需要将参数默认设置为 null。

有什么解决办法吗? 谢谢!

【问题讨论】:

    标签: java playframework routes swagger


    【解决方案1】:

    已通过将 swagger-UI 版本升级到 2.0(最新)修复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 2018-07-13
      • 1970-01-01
      • 1970-01-01
      • 2016-08-10
      • 1970-01-01
      • 2015-11-08
      相关资源
      最近更新 更多