gpt4 book ai didi

java - 个性化路线格式 - Swagger with Play Framework

转载 作者:太空宇宙 更新时间:2023-11-04 13:54:52 25 4
gpt4 key购买 nike

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

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

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

但是当未给出参数时我有“&&”(我的意思是param2和param3)我想要的很简单:

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

这里是:我的 Controller :

@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)

注意:Te 参数是可选的,因此在我的 route 我需要将参数默认设置为 null。

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

最佳答案

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

关于java - 个性化路线格式 - Swagger with Play Framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29923131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com