Overview
package.json exposes validate:openapi → node scripts/validateOpenApi.js, and src/types/api/schemas.ts plus src/services/api/validation.ts exist for runtime validation — but no workflow runs the validation script, and there is no test asserting that the TypeScript types in src/types/ match the specification. The 409 handler in axios.config.ts has a runtime shape guard precisely because the server contract is not otherwise enforced, which is the symptom of a missing contract test.
Specifications
Features:
- The OpenAPI specification validated in CI
- Generated or asserted types kept in sync with the specification
- Response validation applied at the client boundary for critical endpoints
Tasks:
- Add
npm run validate:openapi as a CI step
- Generate types from the specification, or add a test asserting the hand-written types match it
- Apply the
src/services/api/validation.ts guards to auth, payment and sync responses
- Extend
src/services/api/__tests__/validation.test.ts with contract fixtures
Impacted Files:
scripts/validateOpenApi.js
src/types/api/schemas.ts
src/services/api/validation.ts
.github/workflows/ci.yml
Acceptance Criteria
- A specification change that breaks the client fails CI
- Critical responses are validated at runtime
- Types and specification cannot silently diverge
Overview
package.jsonexposesvalidate:openapi→node scripts/validateOpenApi.js, andsrc/types/api/schemas.tsplussrc/services/api/validation.tsexist for runtime validation — but no workflow runs the validation script, and there is no test asserting that the TypeScript types insrc/types/match the specification. The 409 handler inaxios.config.tshas a runtime shape guard precisely because the server contract is not otherwise enforced, which is the symptom of a missing contract test.Specifications
Features:
Tasks:
npm run validate:openapias a CI stepsrc/services/api/validation.tsguards to auth, payment and sync responsessrc/services/api/__tests__/validation.test.tswith contract fixturesImpacted Files:
scripts/validateOpenApi.jssrc/types/api/schemas.tssrc/services/api/validation.ts.github/workflows/ci.ymlAcceptance Criteria