여러 줄 주석이 설명보다 경위(예전·실측·지적)를 적고 있어 읽는 사람이 결론을 찾기 어려웠다. - ts·tsx·js·mjs·css·py 478개: 여러 줄 주석은 첫 문장 한 줄로, 과거형·날짜 문장은 삭제 - 주석 위치는 TypeScript 파서·파이썬 tokenize/ast 로 찾는다 — 문자열 안의 # · /* 는 건드리지 않는다 - eslint·ts·noqa·type: ignore 같은 지시 주석은 그대로 둔다 파이썬 275개 정리 전후 AST 동일, TS 298개 주석 뺀 토큰 동일(빈 JSX 주석 10곳만 차이). site·frontend·admin tsc, site vitest 105 passed Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
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,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|