jny*_*jny 24 swagger-ui spring-boot swagger-2.0 springfox
我正在使用Springfox
库来生成REST服务的文档,并在Swagger UI中显示它.我按照Springfox文档中的说明进行操作.
我有一个控制器,它使用查询字符串中的参数,方法映射如下:
@ApiOperation(value = "")
@RequestMapping(method = GET, value = "/customcollection/{id}/data")
public Iterable<CustomeType> getData(@ApiParam(value = "The identifier of the time series.")
@PathVariable String id,
@ApiParam(name = "startDate", value = "start date", defaultValue = "")
@RequestParam("startDate") String startDate,
@ApiParam(name = "endDate", value = "end date", defaultValue = "")
@RequestParam("endDate") String endDate)
Run Code Online (Sandbox Code Playgroud)
swagger-ui中生成的映射器显示为:
GET /customcollection/{id}/data{?startDate,endDate}
Run Code Online (Sandbox Code Playgroud)
但是当我点击Try it Out时,请求URL会被误认为:
http:// localhost:8080/customcollection/1/data {?startDate,endDate}?startDate = 1&endDate = 2
怎么修好?
jny*_*jny 29
这是由线路造成的
enableUrlTemplating(true)
Run Code Online (Sandbox Code Playgroud)
在Docket
我从示例中复制并忘记删除的配置中.
删除此行后,一切都按预期工作.
归档时间: |
|
查看次数: |
15429 次 |
最近记录: |