java - Common API documentation for multiple paths in a Request Mapping - Stack Overflow

I have a REST Controller in a Spring Boot 3 application. The controller has a post mapping as follows:

I have a REST Controller in a Spring Boot 3 application. The controller has a post mapping as follows:

@PostMapping(value = { "/save", "/save/" })
@Operation(summary = "Method summary", responses = { @ApiResponse(responseCode = 200, description = "A description")})
public ResponseEntity<String> doSomething(@RequestBody SomeClass body) {
...
}
  • Spring Boot version 3.4.2
  • Springdoc OpenAPI library - .springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5

There are two separate entries in Swagger-UI for /save and /save/. This is expected as they are separate paths. But this is redundant for the user as both paths perform the same function from a business logic perspective.

How do I configure Springdoc to show only one entry for the @PostMapping for either /save or /save/ but not both? I'm assuming the approach is to ignore or disable documentation for one of the paths.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744132367a4559897.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信