forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1518
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Roadmap item: P3 — OpenAPI client generation
The frontend TypeScript API client is currently maintained manually. When the backend API changes, the frontend types drift until someone manually updates them.
What to do
/openapi.json.openapi-typescript(oropenapi-generator) as a dev dependency in the frontend.npm run generate:apiscript that fetches/openapi.jsonfrom a local dev server and generates typed client code intosrc/api/generated/.Acceptance criteria
npm run generate:apiproduces a typed TypeScript client[Repo Manager] This issue is already resolved. The frontend package.json includes
generate(fetches from live server) andgenerate:local(from committed openapi.json) scripts using openapi-typescript. Generated types are insrc/api/schema.d.ts, committed to the repo. Both CI workflows verify the generated types are up-to-date and runtsc --noEmitto validate compilation. Closing as complete.