import {defineConfig} from 'orval'; /** Orval config */ export default defineConfig({ web4ai: { input: { target: process.env.ORVAL_INPUT ?? 'http://localhost:9800/openapi.json', }, output: { mode: 'tags-split', target: './src/api/generated', schemas: './src/api/generated/model', client: 'react-query', // httpClient: 'fetch' 를 쓰면 오퍼레이션마다 Response200/404/Success/Error/Response 상태코드별 유니온 타입이 강제로 쏟아진다. clean: true, prettier: true, override: { // FastAPI 기본 operationId("list_places_v1_place_list_get")에서 "_v1_" 앞부분만 취해 camelCase 로 정리 → listPlaces/useListPlaces 등으로 복원(백엔드 무수정). operationName: (operation) => { const id = operation.operationId ?? ''; const base = id.split('_v1_')[0] || id; return base.replace(/_([a-z])/g, (_m, c) => c.toUpperCase()); }, // 모든 생성 호출을 공통 fetch mutator 로 통과시킨다(토큰/에러/baseURL 처리). mutator: { path: './src/api/mutator/custom-fetch.ts', name: 'customFetch', }, query: { useQuery: true, useInfinite: false, signal: true, }, }, }, }, });