Skip to content

Implement API versioning for deployment endpoints using ApiVersionRouter #490

@temma02

Description

@temma02

Description

ApiVersionRouter is tested in apps/backend/tests/api/versioning.test.ts but not wired into any route. Deployment endpoints should be versioned so breaking changes can be introduced without disrupting existing SDK consumers.

Requirements and context

  • Must be secure, tested, and documented where applicable
  • Should stay reviewable and fit the current monorepo structure
  • Relevant files: apps/backend/tests/api/versioning.test.ts, apps/backend/src/app/api/deployments/route.ts, packages/sdk/src/client.ts

Suggested execution

  • Create branch: issue-016-api-versioning-deployment-endpoints
  • Keep changes scoped to the issue and reference the task IDs in the PR

Implement changes

  • Register v1 handlers for GET /api/deployments and POST /api/deployments via ApiVersionRouter
  • Read the version from the API-Version request header; default to v1
  • Return Deprecation response header when a non-current version is requested

Test and commit

  • Add route tests for version header negotiation and deprecation header presence
  • Update CraftClient in the SDK to send API-Version: v1 on all requests
  • Edge case: unknown version — return 400 with supported versions list

Example commit message

feat(api): add versioning to deployment endpoints

Guidelines

  • Prefer small, reviewable PRs
  • Keep naming and data contracts consistent with the spec docs

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions