- api-spec.json → api-spec.yml(内容相同,YAML 更易读) - api:fetch 脚本自动转换 JSON→YAML 后删除 json 临时文件 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
736 B
TypeScript
26 lines
736 B
TypeScript
import { defineConfig } from 'orval'
|
||
|
||
export default defineConfig({
|
||
readingPlatform: {
|
||
input: {
|
||
// 本地开发:使用下载的规范文件(运行 npm run api:update 更新)
|
||
// 服务器直连时改为:'http://8.148.151.56:3002/v3/api-docs'
|
||
target: './api-spec.yml',
|
||
},
|
||
output: {
|
||
// 自动生成到这个目录,不要手动修改这里的文件
|
||
target: 'src/api/generated/api.ts',
|
||
schemas: 'src/api/generated/model',
|
||
client: 'axios',
|
||
// 复用项目里已有的 axios 实例(带 token、错误处理)
|
||
override: {
|
||
mutator: {
|
||
path: 'src/api/request.ts',
|
||
name: 'request',
|
||
},
|
||
},
|
||
prettier: true,
|
||
},
|
||
},
|
||
})
|