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

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

Summary

The frontend currently maintains hand-written API types that can drift from the backend. Auto-generating the TypeScript client from the FastAPI OpenAPI spec eliminates this class of bugs.

Roadmap Reference

P3 Nice to Have -- OpenAPI client generation. See ROADMAP.md.

What to Do

  1. Add openapi-typescript (or openapi-generator-cli) as a dev dependency in the frontend.
  2. Add a generate script in package.json: fetch the OpenAPI spec from the running backend (or from a static export) and generate types into src/api/generated.ts.
  3. Add a CI step that regenerates the client and fails if the output differs from what is committed (ensuring the generated file stays in sync).
  4. Replace any hand-written API type definitions in the frontend with imports from the generated file.

Acceptance Criteria

  • Running npm run generate (or equivalent) produces a TypeScript client from the live or exported OpenAPI spec.
  • All existing frontend API calls compile without errors using the generated types.
  • CI fails if generated types are out of sync with the backend spec.
  • No hand-written API response types remain in the frontend codebase that duplicate generated types.
## Summary The frontend currently maintains hand-written API types that can drift from the backend. Auto-generating the TypeScript client from the FastAPI OpenAPI spec eliminates this class of bugs. ## Roadmap Reference P3 Nice to Have -- OpenAPI client generation. See ROADMAP.md. ## What to Do 1. Add openapi-typescript (or openapi-generator-cli) as a dev dependency in the frontend. 2. Add a generate script in package.json: fetch the OpenAPI spec from the running backend (or from a static export) and generate types into src/api/generated.ts. 3. Add a CI step that regenerates the client and fails if the output differs from what is committed (ensuring the generated file stays in sync). 4. Replace any hand-written API type definitions in the frontend with imports from the generated file. ## Acceptance Criteria - Running npm run generate (or equivalent) produces a TypeScript client from the live or exported OpenAPI spec. - All existing frontend API calls compile without errors using the generated types. - CI fails if generated types are out of sync with the backend spec. - No hand-written API response types remain in the frontend codebase that duplicate generated types.
AI-Manager added the P3agent-readymediuminfra labels 2026-03-29 03:23:23 +00:00
Author
Owner

Resolved by PR #443. TypeScript API client auto-generated from FastAPI OpenAPI spec with CI freshness check.

Resolved by PR #443. TypeScript API client auto-generated from FastAPI OpenAPI spec with CI freshness check.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#848