/** * orval configuration — OpenAPI client generation for Veza frontend. * * v1.0.8 Phase 1 (B1). Generates typed Axios services + React Query hooks * from `veza-backend-api/openapi.yaml` (produced by swaggo). Output lives * alongside hand-written services during the migration, then supersedes * them in Phase 3. * * Design choices (cf. /home/senke/.claude/plans/audit-fonctionnel-wild-hickey.md D8): * - client: 'react-query' → emits hooks directly (useXxx / useXxxMutation) * - mode: 'tags-split' → one folder per `@Tags` → smaller bundles + easier diff * - mutator: './src/services/api/orval-mutator.ts' vezaMutator * Routes every generated call through the existing Axios instance so * auth / retry / CSRF / offline-queue interceptors keep applying. * - mock: false → MSW handlers stay manual (endpoint-shape * matching, not spec-schema matching). Phase 2 * may revisit once drift is eliminated. * * Run: npx orval --config orval.config.ts * Or: npm run generate:types (check-types-sync.sh → scripts/generate-types.sh) */ import { defineConfig } from 'orval'; export default defineConfig({ veza: { input: { target: '../../veza-backend-api/openapi.yaml', }, output: { target: 'src/services/generated/veza.ts', schemas: 'src/services/generated/model', client: 'react-query', mode: 'tags-split', mock: false, prettier: true, clean: true, override: { mutator: { path: './src/services/api/orval-mutator.ts', name: 'vezaMutator', }, query: { useQuery: true, useMutation: true, signal: true, }, // v1.0.10 polish: by default orval emits a multi-status discriminated // wrapper `{data, status, headers}` per response. That misaligned with // our runtime — vezaMutator returns the raw body (post-interceptor // unwrap of {success, data}) — and forced consumers into casts like // `result as unknown as ` (cf. dashboardService.ts:91-93). // Disabling the wrapper makes generated types match runtime; consumers // can read fields directly off the hook's `data`. fetch: { includeHttpResponseReturnType: false, }, }, }, }, });