繁体   English   中英

swagger 2 spring boot - 有 2 个同名的 API,但只显示其中一个

[英]swagger 2 spring boot - having 2 APIs of the same name but only display one of it

出于某种原因,我有 2 个同名的 API。

第一

@ApiOperation(value="")
@RequestMapping(value="/predict", method= RequestMethod.POST, produces="application/json", headers="content-encoding=gzip")
public ResponseEntity<?> predictBinary(HttpServletRequest requestEntity,  @RequestHeader Map<String, Object> header) {

第二个

@ApiOperation(value="")
@RequestMapping(value="/predict", method= RequestMethod.POST, produces="application/json", consumes="application/json")
public ResponseEntity predict(@RequestBody RequestInput inputs, @RequestHeader Map<String, Object> header) {

有没有办法只显示第二个? 现在swagger随机选择一个显示,有时我看到First one有时我看到Second one我尝试删除First one的@ApiOperation它没有帮助。

您可能会尝试像现在一样使用 /predict 更改自己的路径,这可能是因为 spring 控制器可能存在模棱两可的问题,因此最好为每个路径使用不同的路径,并且 swagger 可能也会发生同样的情况,因此它会随机获取这些 API 详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM