# 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.
