Closed
Description
Bug description
When one controller method with endpoints definitions contains multiple paths with different path variables, then generated documentation shows that each endpoint has all of the path variables defined in that controller method.
To Reproduce
- Implement controller with only one
@RequestMapping
method with two paths that contain different path variables. - Generate API docs and notice that each endpoint has all of the path variables.
-
What version of spring-boot you are using?
2.5.5
-
What modules and versions of springdoc-openapi are you using?
springdoc-openapi-ui 1.6.14
-
Sample code that reproduces the problem
@GetMapping(path = {"/orders/{shopName}", "/orders/{shopName}/customer/{customerId}"}, produces = MediaType.APPLICATION_JSON_VALUE)
public Object getOrders(@PathVariable(value = "customerId", required = false) Long customerId,
@PathVariable("shopName") String shopName) {
if (Objects.isNull(customerId)) {
return orderRepository.findAllByShopName(shopName);
}
return orderRepository.findAllByShopNameAndCustomerId(shopName, customerId);
}
Actual behavior
One of the endpoints was generated properly:
But other endpoint has two path variables, but it should contain only shopName
path variable:
Expected behavior
Endpoint /orders/{shopName}
should have only one parameter - shopName
, parameters from other endpoints should not be visible.