ADR-0003: URI-path API versioning + breaking-change gate¶
- Status: Accepted
- Deciders: Platform engineering
- Context: specs 015 / 017 / 027
Context¶
Public APIs evolve, but clients (the ops console, connect portals, integrators) must not break unannounced. We need (a) an unambiguous way to address a version and (b) automated protection against shipping an incompatible change to an existing version.
Decision¶
- Version in the URI path:
/api/v1/.... It is explicit, cache-friendly, trivially routable by the gateway (spec 027 can weightv1/canary/v2pools), and obvious in logs and specs. - The OpenAPI contract is generated from the running code and committed
(
api-spec/multi-tenancy-core-v1.json). A breaking-change gate (spec 017,oasdiffagainst a committed.baseline.json) fails CI on an incompatible change to an existing version. - Spec 109 hardens the seam further: an OpenAPI-regen gate (RW-760) fails if the committed contract goes stale versus the code, and a contract-drift gate (RW-753) fails if the frontend's generated types diverge from the published contract.
Consequences¶
- Breaking changes require a new version path (
/api/v2/...), never an in-place mutation ofv1. - The committed contract is authoritative and always current, so both the gateway and the frontend can bind to it with confidence.
- Additive changes are allowed within a version but still require regenerating + committing the contract (the regen gate enforces this).