Files
kami_apple_exchage/frontend/orval.config.ts
danial 5c486e34d3 docs(项目): 添加项目文档并进行代码调整
- 新增 CODEBUDDY.md、GEMINI.md、GEMINI_CN.md 等项目文档
- 更新 Dockerfile 和其他配置文件
- 优化部分代码结构,如 orders.py、tasks.py 等
- 新增 .dockerignore 文件
2025-09-12 19:38:24 +08:00

69 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const orvalConfig = {
// 爬虫监控系统 API 配置
petstore: {
prettier: true,
output: {
mode: "tags",
target: "src/lib/api/generated/endpoints",
schemas: "src/lib/api/generated/schemas",
client: "react-query",
fileExtension: '.gen.ts',
mock: false,
clean: true, // 每次生成前清理目标目录
override: {
mutator: {
path: "src/lib/api/enhanced-axios-client.ts",
name: "axiosClient",
},
// 全局 Query 配置
query: {
useQuery: true,
useMutation: true,
useInfiniteQuery: false, // 项目暂不需要无限查询
signal: true, // 支持 AbortController
shouldExportMutatorHooks: true,
shouldExportHttpClient: false,
},
// 忽略特定操作(备用)
operations: {},
// 自定义 Hook 命名规则
requestOptions: {
second: true, // 支持第二个参数作为选项
},
// 响应类型优化
mock: {
type: 'msw', // 使用 MSW 进行 mock如果需要
delay: false,
},
},
},
hooks: {
// 生成前的预处理
beforeAllFilesWrite: [
"echo '🚀 开始生成 API 客户端代码...'",
],
// 生成后的后处理
afterAllFilesWrite: [
"prettier --write src/lib/api/generated/**/*.ts",
"echo '✅ API 客户端代码生成完成!'",
"echo '📁 生成位置: src/lib/api/generated/'",
],
},
input: {
target: "http://localhost:8000/openapi.json",
filters: {
mode: 'exclude',
tags: ['Health Check'],
},
},
},
};
export default orvalConfig;