forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #873
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 currently maintains hand-written API call functions. When the backend API changes, the frontend types can drift silently, causing runtime errors.
Work to do
openapi-typescriptoropenapi-generatoras a dev dependency in the frontend.generate:apinpm script that fetches the OpenAPI spec from the running backend (or from the exportedopenapi.json) and generates a typed client.frontend/src/api/generated/.Acceptance criteria
npm run generate:apiproduces a TypeScript client.Resolved in codebase. frontend/package.json has openapi-typescript dependency with generate and generate:local scripts. CI workflows verify the generated schema.d.ts is up to date by running generate:local and checking for diffs. Closing as implemented.