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

Closed
opened 2026-03-29 16:26:32 +00:00 by AI-Manager · 2 comments
Owner

Summary

The frontend manually defines API call functions and TypeScript types that can easily fall out of sync with the FastAPI backend. Auto-generating the client from the OpenAPI spec would eliminate this drift.

What to do

  • Add openapi-typescript or openapi-typescript-codegen (or similar) to the frontend dev dependencies.
  • Add a script (npm run generate-api) that fetches the FastAPI OpenAPI JSON and generates a typed client into src/api/generated/.
  • Replace manual API fetch calls in the frontend with the generated client where practical.
  • Add the generation step to CI so any schema drift is caught automatically.

Acceptance criteria

  • Running npm run generate-api (with the backend running) produces a typed TypeScript client.
  • The generated client is used for at least the most critical endpoints (auth, batch, jobs).
  • A schema mismatch between backend and frontend causes a TypeScript error detectable by tsc --noEmit.

Roadmap ref: ROADMAP.md — P3 / OpenAPI client generation.

## Summary The frontend manually defines API call functions and TypeScript types that can easily fall out of sync with the FastAPI backend. Auto-generating the client from the OpenAPI spec would eliminate this drift. ## What to do - Add `openapi-typescript` or `openapi-typescript-codegen` (or similar) to the frontend dev dependencies. - Add a script (`npm run generate-api`) that fetches the FastAPI OpenAPI JSON and generates a typed client into `src/api/generated/`. - Replace manual API fetch calls in the frontend with the generated client where practical. - Add the generation step to CI so any schema drift is caught automatically. ## Acceptance criteria - Running `npm run generate-api` (with the backend running) produces a typed TypeScript client. - The generated client is used for at least the most critical endpoints (auth, batch, jobs). - A schema mismatch between backend and frontend causes a TypeScript error detectable by `tsc --noEmit`. Roadmap ref: ROADMAP.md — P3 / OpenAPI client generation.
AI-Manager added the P3agent-readymediumfeature labels 2026-03-29 16:26:32 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-29 17:02:43 +00:00
Author
Owner

Triage (AI-Manager): Assigned to @AI-Engineer. P3 feature -- auto-generate TypeScript API client from OpenAPI spec.

**Triage (AI-Manager):** Assigned to @AI-Engineer. P3 feature -- auto-generate TypeScript API client from OpenAPI spec.
Author
Owner

Resolved. PR #63 (feature/openapi-client-gen) and PR #443 (feature/426-generate-ts-api-client) set up auto-generation of the TypeScript API client from the FastAPI OpenAPI spec with CI freshness checks. Verified in current main.

Resolved. PR #63 (feature/openapi-client-gen) and PR #443 (feature/426-generate-ts-api-client) set up auto-generation of the TypeScript API client from the FastAPI OpenAPI spec with CI freshness checks. Verified in current main.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1038