이름: solution/front → solution/frontend
`backend` 옆에 `front` 가 있을 이유가 없었다. negosium 의 negodata/front 를 그대로 베꼈고 그게 왜 front 인지는 따져보지 않았다 — 근거 없이 들여온 이름이라 바로잡는다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019uYhHQdssRubirPirrdJJC
This commit is contained in:
1 parent
06f6438d9b
commit
c85c577349
480 files changed
+22
-22
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import {defineConfig} from 'orval';
|
||||
|
||||
/**
|
||||
* Orval config
|
||||
*
|
||||
* Backend: FastAPI (o2o-web4ai API) — OpenAPI 스키마를 `${BACKEND_URL}/openapi.json` 에 자동 노출한다.
|
||||
* 포트 9800 (negosium 9300 / negodata 9400 / agent 9500 / lps 9600 / anchoring 9700 다음 번호).
|
||||
*
|
||||
* 네이티브 `fetch` 기반 React Query 클라이언트를 만든다(axios 불필요).
|
||||
* 실행: `npm run orval`
|
||||
*
|
||||
* 서버를 안 띄우고 생성하려면 백엔드가 뽑아둔 파일을 지정한다:
|
||||
* ORVAL_INPUT=../backend/openapi.json npm run orval
|
||||
*/
|
||||
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
|
||||
// 상태코드별 유니온 타입이 강제로 쏟아진다. 우리 mutator 는 본문(data)만 반환하므로
|
||||
// 기본 mutator 방식(config-object)으로 두어 함수가 본문 타입을 바로 반환하게 한다.
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user