mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 09:28:47 +02:00
OpenAPI type codegen with CI drift gate (plan 3.4, ARCH-16, FE-14)
Every dict-returning route the SPA consumes now declares a response model (auth, bulk, sync-status, notifications). api-types.gen.ts is generated from app.openapi() via openapi-typescript, and the 22 hand- written read interfaces in api.ts are now aliases onto the generated schemas — backend schema drift becomes a typecheck failure, and CI regenerates the file and fails the deploy if it's stale. The aliasing immediately caught two real drifts: RecurringItemType was missing SAVINGS, and raw_charges (untyped JSON column) is now explicitly shaped at the boundary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
10
.github/workflows/deploy.yml
vendored
10
.github/workflows/deploy.yml
vendored
@@ -18,11 +18,17 @@ jobs:
|
||||
/tmp/test-venv/bin/pip install --quiet -r requirements.txt -r requirements-dev.txt
|
||||
/tmp/test-venv/bin/python -m pytest tests/ -q
|
||||
|
||||
- name: Frontend typecheck
|
||||
- name: Frontend typecheck + API type drift gate
|
||||
run: |
|
||||
cd frontend
|
||||
cd backend
|
||||
DATABASE_URL='sqlite://' SECRET_KEY='ci-only-0123456789abcdef0123456789abcdef0123456789abcdef' \
|
||||
ADMIN_USERNAME=ci ADMIN_PASSWORD=ci-not-admin OPENAI_API_KEY=dummy \
|
||||
/tmp/test-venv/bin/python -c "import json; from app.main import app; json.dump(app.openapi(), open('../frontend/openapi.json','w'), indent=1, sort_keys=True)"
|
||||
cd ../frontend
|
||||
corepack enable
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm exec openapi-typescript openapi.json -o src/lib/api-types.gen.ts
|
||||
git diff --exit-code src/lib/api-types.gen.ts
|
||||
pnpm typecheck
|
||||
|
||||
deploy:
|
||||
|
||||
Reference in New Issue
Block a user