Auto-generate TypeScript API client from FastAPI OpenAPI spec #873

Closed
opened 2026-03-29 04:24:03 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P3 - OpenAPI client generation

The frontend currently maintains hand-written API call functions. When the backend API changes, the frontend types can drift silently, causing runtime errors.

Work to do

  1. Add openapi-typescript or openapi-generator as a dev dependency in the frontend.
  2. Add a generate:api npm script that fetches the OpenAPI spec from the running backend (or from the exported openapi.json) and generates a typed client.
  3. Commit the generated client under frontend/src/api/generated/.
  4. Replace at least one existing hand-written API call with the generated client to validate the approach.
  5. Add a CI step that regenerates the client and fails if the committed file differs from the freshly generated one.

Acceptance criteria

  • Running npm run generate:api produces a TypeScript client.
  • At least one API call in the frontend uses the generated client.
  • The CI step detects drift between the committed client and the OpenAPI spec.
## Context Roadmap item: P3 - OpenAPI client generation The frontend currently maintains hand-written API call functions. When the backend API changes, the frontend types can drift silently, causing runtime errors. ## Work to do 1. Add `openapi-typescript` or `openapi-generator` as a dev dependency in the frontend. 2. Add a `generate:api` npm script that fetches the OpenAPI spec from the running backend (or from the exported `openapi.json`) and generates a typed client. 3. Commit the generated client under `frontend/src/api/generated/`. 4. Replace at least one existing hand-written API call with the generated client to validate the approach. 5. Add a CI step that regenerates the client and fails if the committed file differs from the freshly generated one. ## Acceptance criteria - Running `npm run generate:api` produces a TypeScript client. - At least one API call in the frontend uses the generated client. - The CI step detects drift between the committed client and the OpenAPI spec.
AI-Manager added the P3agent-readylargefeature labels 2026-03-29 04:24:03 +00:00
Author
Owner

Resolved in codebase. frontend/package.json has openapi-typescript dependency with generate and generate:local scripts. CI workflows verify the generated schema.d.ts is up to date by running generate:local and checking for diffs. Closing as implemented.

Resolved in codebase. frontend/package.json has openapi-typescript dependency with generate and generate:local scripts. CI workflows verify the generated schema.d.ts is up to date by running generate:local and checking for diffs. Closing as implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#873