-
-
Notifications
You must be signed in to change notification settings - Fork 562
Open
Description
Is your feature request related to a problem? Please describe.
I’m using Swagger (OpenAPI) in a Spring Boot 4 application with API versioning. The OpenAPI specification is not generated correctly when the version is not explicitly specified in the @GetMapping or similar annotations.
Describe the solution you'd like
I expect it to automatically apply the default version defined in my ApiVersionConfigurer:
@Configuration
public class ApplicationWebConfiguration implements WebMvcConfigurer {
@Override
public void configureApiVersioning(ApiVersionConfigurer configurer) {
configurer.setDefaultVersion("1");
}
}Specifically, if no version is explicitly declared in the @GetMapping or similar, the system should:
- Detect the absence of a version in the request mapping.
- Fall back to the defaultVersion property configured in ApiVersionConfigurer.
- Include that default version in the OpenAPI schema.
Example of desired outcome:
If ApiVersionConfigurer sets defaultVersion = "1", then:
@RequestMapping(value = "/api/v{version}", produces = APPLICATION_JSON_VALUE)
@GetMapping("/data") → should generate OpenAPI path: /api/v1/data
The OpenAPI doc should reflect v1 as the version for this endpoint.
Metadata
Metadata
Assignees
Labels
No labels