Description
The API is documented only via code comments and ad-hoc markdown; there is no machine-readable contract. This backend task introduces an OpenAPI 3.1 document covering /api/billing/deduct, /api/usage, /api/apis, and /api/developers/revenue, served at a /api/openapi.json route and validated in CI.
Requirements and Context
- Author an OpenAPI 3.1 spec describing request/response schemas and error shapes from
src/errors/index.ts.
- Serve it from a new route mounted in
src/routes/index.ts.
- Add a test that lints the spec and checks route coverage.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b task/openapi-spec
- Implement changes
docs/openapi.json (or generated) — the spec
src/routes/index.ts — serve /api/openapi.json
- Add a spec validation test
- Test and commit
npm test -- src/app.test.ts
- Cover edge cases
- Include test output and notes in the PR
Example commit message
task: add OpenAPI 3.1 spec for core routes
Acceptance Criteria
Guidelines
- Minimum 90% test coverage with Jest for the serving route
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
The API is documented only via code comments and ad-hoc markdown; there is no machine-readable contract. This backend task introduces an OpenAPI 3.1 document covering
/api/billing/deduct,/api/usage,/api/apis, and/api/developers/revenue, served at a/api/openapi.jsonroute and validated in CI.Requirements and Context
src/errors/index.ts.src/routes/index.ts.Suggested Execution
docs/openapi.json(or generated) — the specsrc/routes/index.ts— serve/api/openapi.jsonnpm test -- src/app.test.tsExample commit message
Acceptance Criteria
/api/openapi.jsonreturns a valid OpenAPI 3.1 documentGuidelines