最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论