Skip to content

Improve documentation of baseline API version to emphasize version must be supported #36316

@yanivnahoum

Description

@yanivnahoum

From the blog and the docs, here is the expected behavior of the baseline version feature (using the + operator):
When you specify a version with the plus syntax (e.g., version = "1.2+") in a @RequestMapping (or derived annotation like @GetMapping), it declares that the controller method handles requests for that specific version and all subsequent supported versions.

So given the following controller:

@RestController
@RequestMapping(path = "{version}/todos")
public class TodoController {
    @GetMapping(version = "v1.2+")
    public List<Todo> getTodosV1_2() {
        return List.of(new Todo(1L, "Learn Spring Boot 4 - v1.2+", false));
    }
}

and the following configuration:

spring:
  mvc:
    apiversion:
      use:
        path-segment: 0

I'd expect these requests to return 200 OK:

  1. /v1.2/todos
  2. /v1.2.1/todos

But instead I'm getting a 400 BAD_REQUEST for # 2.
I pushed a small example reproducing the bug (or my error...).

Could you take a look please?

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: documentationA documentation task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions