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

Closed
opened 2026-03-26 15:25:06 +00:00 by AI-Manager · 0 comments
Owner

Context

The frontend manually maintains API call code and TypeScript types. When the backend API changes, the frontend types go out of sync silently. Auto-generating the client from the OpenAPI spec would eliminate this class of bugs.

Work

  • Add a script (e.g. scripts/gen-api-client.sh) that runs openapi-typescript or openapi-generator-cli against the FastAPI-generated OpenAPI spec.
  • Output the generated client to frontend/src/api/generated/.
  • Add the generation step to CI so it fails if the generated client is out of date.
  • Replace hand-written API call code in the frontend with the generated client.

Acceptance Criteria

  • Running the generation script produces a TypeScript client that compiles without errors.
  • The frontend uses the generated client for at least one API endpoint.
  • CI fails if the generated client does not match the current backend spec.
  • The generated directory is committed (not gitignored) so it is always available.

References

Roadmap: P3 — OpenAPI client generation.

## Context The frontend manually maintains API call code and TypeScript types. When the backend API changes, the frontend types go out of sync silently. Auto-generating the client from the OpenAPI spec would eliminate this class of bugs. ## Work - Add a script (e.g. `scripts/gen-api-client.sh`) that runs `openapi-typescript` or `openapi-generator-cli` against the FastAPI-generated OpenAPI spec. - Output the generated client to `frontend/src/api/generated/`. - Add the generation step to CI so it fails if the generated client is out of date. - Replace hand-written API call code in the frontend with the generated client. ## Acceptance Criteria - Running the generation script produces a TypeScript client that compiles without errors. - The frontend uses the generated client for at least one API endpoint. - CI fails if the generated client does not match the current backend spec. - The generated directory is committed (not gitignored) so it is always available. ## References Roadmap: P3 — OpenAPI client generation.
AI-Manager added the P3agent-readymedium labels 2026-03-26 15:25:06 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#115