import { defineConfig } from 'orval' export default defineConfig({ api: { // sdk 파일 및 모델 가져올 swagger 서버 주소 input: 'http://40.82.133.44:8001/openapi.json', output: { mode: 'tags-split', target: './src/shared/api/generated', schemas: './src/shared/api/model', client: 'react-query', httpClient: 'fetch', clean: true, prettier: true, override: { mutator: { path: './src/shared/api/api.ts', name: 'customFetcher', }, query: { useQuery: true, useMutation: true, // orval 7.21이 fetch httpClient + queryFn 조합에서 signal을 잘못 넘기는 버그가 있어 비활성 signal: false, options: { staleTime: 60_000, }, }, operationName: (operation) => { // FastAPI 기본 operationId: __\ // 컨트롤러 함수명만 사용하기 const opId = operation.operationId ?? '' const verbPattern = /_(get|post|put|delete|patch|options|head)$/i const beforeApi = opId.split(/_api_/)[0] const name = beforeApi !== opId ? beforeApi : opId.replace(verbPattern, '') return name.replace(/_+([a-zA-Z])/g, (_, c) => c.toUpperCase()) }, }, }, }, })