This SDK generates TypeScript types from the backend OpenAPI specification.
# Regenerate types from the vendored spec
npm run codegen
# Or specify a custom spec path
npx tsx scripts/codegen.ts path/to/custom-spec.yaml- The authoritative OpenAPI spec is vendored at
openapi/lily-backend.yaml - Running
npm run codegeninvokesscripts/codegen.ts, which callsopenapi-typescript - Generated output goes to
src/generated/types.ts(committed to the repo) - Hand-written models in
src/models/and contracts insrc/types/contracts.tsare additive — they add method signatures and convenience types on top of the generated schema types
- After updating
openapi/lily-backend.yamlwith backend changes - Before submitting a PR that modifies API contracts
- As part of CI drift detection (see issue #98)
| Path | Purpose |
|---|---|
openapi/lily-backend.yaml |
Vendored backend OpenAPI spec (source of truth) |
scripts/codegen.ts |
Codegen script that wraps openapi-typescript |
src/generated/types.ts |
Auto-generated types (DO NOT EDIT MANUALLY) |
src/models/* |
Hand-written model interfaces (additive overrides) |
src/types/contracts.ts |
Client contract interfaces with method signatures |
openapi-typescript(devDependency) — generates TS types from OpenAPI specstsx(devDependency) — runs the TypeScript codegen script directly