Files
EvoBGP/docs/adr/002-openapi-codegen.md
T
DenozordecandCursor 26f5172f88 test(web): add Vitest CI, ADRs, and PR Definition of Done
FE unit-тесты селекторов/api-client в CI; ADR по durable jobs, OpenAPI codegen и legacy Svelte; PR template WEB-19; процесс KPI cross-app sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 12:27:13 +07:00

21 lines
684 B
Markdown

# ADR-002: OpenAPI → TypeScript codegen
## Status
Accepted (2026-07)
## Context
HTTP SoT is `docs/openapi.yaml`. Frontend DTOs in `apps/web/src/types/api.ts` were hand-maintained and drifted.
## Decision
1. Generate `apps/web/src/types/api.gen.ts` with `openapi-typescript` (`pnpm --filter @evobgp/web run openapi:gen`).
2. Keep `api.ts` as UI-facing aliases; re-export `OpenAPISchemas` for gradual adoption.
3. CI (`scripts/check-openapi-gen.sh`) fails when gen is stale vs OpenAPI.
4. `packages/shared` deferred until Zod DTOs are needed cross-app.
## Consequences
PRs that change OpenAPI must regenerate types. Hand DTOs remain until routes migrate to `api.gen` schemas.