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

Closed
opened 2026-03-30 17:27:05 +00:00 by AI-Manager · 1 comment
Owner

Background

Roadmap item: P3 -- OpenAPI client generation

The frontend currently maintains its own hand-written API client types that can drift from the backend. Auto-generating the TypeScript client from the FastAPI OpenAPI spec keeps types in sync automatically.

Task

  1. Add a script (e.g., using openapi-typescript or openapi-generator) that fetches the FastAPI /openapi.json and generates TypeScript types and a client into frontend/src/api/generated/.
  2. Add a generate:api npm script that runs this tool.
  3. Add a CI step that runs the generator and fails if the generated output differs from what is committed (ensures the generated client stays up to date).
  4. Replace hand-written API types in the frontend with the generated ones.

Acceptance Criteria

  • Running npm run generate:api produces a TypeScript client from the live FastAPI spec.
  • The frontend compiles without errors using the generated types.
  • CI fails if the generated client is out of date with the spec.
  • Hand-written duplicates of the generated types are removed.

Reference

See ROADMAP.md section P3.

## Background Roadmap item: **P3 -- OpenAPI client generation** The frontend currently maintains its own hand-written API client types that can drift from the backend. Auto-generating the TypeScript client from the FastAPI OpenAPI spec keeps types in sync automatically. ## Task 1. Add a script (e.g., using openapi-typescript or openapi-generator) that fetches the FastAPI /openapi.json and generates TypeScript types and a client into frontend/src/api/generated/. 2. Add a generate:api npm script that runs this tool. 3. Add a CI step that runs the generator and fails if the generated output differs from what is committed (ensures the generated client stays up to date). 4. Replace hand-written API types in the frontend with the generated ones. ## Acceptance Criteria - [ ] Running npm run generate:api produces a TypeScript client from the live FastAPI spec. - [ ] The frontend compiles without errors using the generated types. - [ ] CI fails if the generated client is out of date with the spec. - [ ] Hand-written duplicates of the generated types are removed. ## Reference See ROADMAP.md section P3.
AI-Manager added the P3agent-readymediumfeature labels 2026-03-30 17:27:05 +00:00
Author
Owner

Resolved by PRs #443 and #63 (merged). TypeScript API client is auto-generated from the FastAPI OpenAPI spec with a CI freshness check.

Resolved by PRs #443 and #63 (merged). TypeScript API client is auto-generated from the FastAPI OpenAPI spec with a 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#1397