Establish API versioning and pagination response standard #22

Open
opened 2026-04-20 09:37:17 +00:00 by sharang · 0 comments
Owner

Problem

API responses have no version field. When the schema changes, clients have no way to detect or handle the difference. Combined with missing pagination metadata (#13), clients cannot build reliable pagination UI.

Required Actions

  1. Add api_version: str to all response schemas (current value: "v1")
  2. Adopt PaginatedResponse[T] (from #13) as the standard for all list endpoints
  3. Document the versioning policy in AGENTS.python.md:
    • Additive changes (new optional fields) → no version bump
    • Breaking changes (removed/renamed fields) → new route version (/api/v2/)
  4. Add a contract test that diffs live /openapi.json against tests/contracts/openapi.baseline.json — fails CI on breaking changes
  5. Update openapi.baseline.json intentionally when a breaking change is approved

Acceptance Criteria

## Problem API responses have no version field. When the schema changes, clients have no way to detect or handle the difference. Combined with missing pagination metadata (#13), clients cannot build reliable pagination UI. ## Required Actions 1. Add `api_version: str` to all response schemas (current value: `"v1"`) 2. Adopt `PaginatedResponse[T]` (from #13) as the standard for all list endpoints 3. Document the versioning policy in `AGENTS.python.md`: - Additive changes (new optional fields) → no version bump - Breaking changes (removed/renamed fields) → new route version (`/api/v2/`) 4. Add a contract test that diffs live `/openapi.json` against `tests/contracts/openapi.baseline.json` — fails CI on breaking changes 5. Update `openapi.baseline.json` intentionally when a breaking change is approved ## Acceptance Criteria - OpenAPI baseline test runs in CI and is non-skipped - All list endpoints return `PaginatedResponse` - Depends on: #13
sharang added this to the M4: Testing & Contract Stability milestone 2026-04-20 09:37:17 +00:00
sharang added the data-integrityseverity: medium labels 2026-04-20 09:37:17 +00:00
Sign in to join this conversation.