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
Description
ApiVersionRouteris tested inapps/backend/tests/api/versioning.test.tsbut not wired into any route. Deployment endpoints should be versioned so breaking changes can be introduced without disrupting existing SDK consumers.Requirements and context
apps/backend/tests/api/versioning.test.ts,apps/backend/src/app/api/deployments/route.ts,packages/sdk/src/client.tsSuggested execution
issue-016-api-versioning-deployment-endpointsImplement changes
v1handlers forGET /api/deploymentsandPOST /api/deploymentsviaApiVersionRouterAPI-Versionrequest header; default tov1Deprecationresponse header when a non-current version is requestedTest and commit
CraftClientin the SDK to sendAPI-Version: v1on all requestsExample commit message
Guidelines