forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1544
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
Frontend TypeScript types for API requests and responses are manually maintained. As the backend evolves, these types drift out of sync, causing runtime errors that are not caught at compile time.
Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation
What to do
openapi-typescriptoropenapi-generator-clias a dev dependency in the frontendnpm run generate-apiscript that fetches the OpenAPI spec from the running backend and generatessrc/api/generated.tsAcceptance criteria
npm run generate-apiproduces a TypeScript client from the OpenAPI spectsc --noEmitpasses with the generated client in useTriage review: Resolved: openapi-typescript is configured in package.json with generate and generate:local scripts. schema.d.ts exists. CI checks freshness. Closing as already complete.