-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Open
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Component: WebMvcAutoConfiguration.configureApiVersioningUse()
Issue: PathApiVersionResolver never returns null (as stated in its own Javadoc), so any resolvers added after it in the list are unreachable. Currently the media-type parameter resolver is added after the path-segment resolver.
Fix: Move map.from(use::getPathSegment).to(configurer::usePathSegment) to the end of the method, after the media-type parameter registration.
The following config will show the issue when the request is trying to use the media type to supply the API Version. Instead of trying the media type param resolver is tries the path resolver and then ends before trying the media type param resolve.
spring:
mvc:
api-version:
supported:
- "1.0"
use:
header: "X-API-Version"
query-parameter: "api-version"
media-type-parameter:
"[application/json]": "version"
"[application/vnd.resource+json]": "version"
path-segment: 0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged