Zum Inhalt springen

Api Versioning (ARCH4202)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key java.quality.api-versioning · Severity info · Category quality

Unversioned APIs make backward-incompatible changes impossible to ship safely. Add an explicit version to the route path so you can evolve without breaking clients.

@RestController
@RequestMapping("/orders")
class OrderController {
@GetMapping("/{id}")
Order get(@PathVariable long id) { return service.find(id); }
}
@RestController
@RequestMapping("/api/v1/orders")
class OrderController {
@GetMapping("/{id}")
Order get(@PathVariable long id) { return service.find(id); }
}

Add an explicit API version to the route path (/api/v1/...) or via a version attribute.