简体   繁体   English

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

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

I have 2 APIs with the same name for a reason.出于某种原因,我有 2 个同名的 API。

First one第一

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

Second one第二个

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

Is there a way to only display the second one?有没有办法只显示第二个? Right now swagger randomly chooses one to display, sometimes I see the First one sometimes I see the Second one I tried removing the @ApiOperation for the First one it doesn't help.现在swagger随机选择一个显示,有时我看到First one有时我看到Second one我尝试删除First one的@ApiOperation它没有帮助。

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

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

相关问题 spring boot项目中的swagger配置,对于同一个request model,需要展示不同的response,request model中的例子 - Swagger configuration in spring boot project, for same request model, need to display different responses, example in request model 如果我在 Spring boot 中对方法有多个映射,如何仅从 swagger ui 文档中隐藏一个映射 - How to hide only one mapping from swagger ui documentation if I more than one mapping for method in Spring boot 验证 Spring Boot API - Authenticating Spring Boot APIs Spring 启动、Swagger 和授权 - Spring Boot, Swagger and Authorisation Spring 引导 Swagger 2 配置错误创建名为“documentationPluginsBootstrapper”的 bean - Spring Boot Swagger 2 Configuration Error creating bean with name 'documentationPluginsBootstrapper' 将 spring 引导连接到 swagger - connect spring boot to swagger Swagger 2 问题 spring 启动 - Swagger 2 Issue spring Boot Swagger 2 问题 - Spring 启动 - Swagger 2 Issue - Spring Boot Swagger (Springfox) 只找到控制器 @RequestBody (Spring Boot) 中使用的模型 - Swagger (Springfox) only finding Models used in Controller @RequestBody (Spring Boot) (Spring Boot (v2.3.1) 与 swagger (v2.9.2) 的集成仅对 swagger-ui 失败,但适用于 swagger。 - Spring Boot (v2.3.1) integration with swagger (v2.9.2) fails only for swagger-ui but works fine with swagger (v 2.8.0)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM