forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1419
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 manually defines API types that can drift from the backend schema. Auto-generating the TypeScript client from FastAPI's OpenAPI spec would keep types in sync automatically.
What to do
openapi-typescript(oropenapi-generator) code generation step to the frontend build or a dedicated script.src/api/generated/directory.fetchcalls and type definitions with the generated client where practical.Acceptance criteria
Triage: Already resolved in main.
TypeScript API client auto-generation is fully set up:
openapi-typescript(v7) is a devDependency infrontend/package.jsonnpm run generatefetches live OpenAPI spec;npm run generate:localuses committed specfrontend/src/api/schema.d.tstest.yaml) verifies generated types are up-to-date by runninggenerate:localand checking for diffsfrontend/src/types/index.tsderive from the generated schemaClosing as complete.