• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


26 Mar, 2025

Updated at 20 May, 2025

Common API documentation for multiple paths in a Request Mapping

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 doSomething(@RequestBody SomeClass body) {
...
}
  • Spring Boot version 3.4.2
  • Springdoc OpenAPI library - org.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.