32 lines
764 B
TypeScript
32 lines
764 B
TypeScript
|
|
import { defineConfig } from 'orval';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
readingPlatform: {
|
||
|
|
output: {
|
||
|
|
mode: 'split',
|
||
|
|
target: 'src/api/generated/index.ts',
|
||
|
|
schemas: 'src/api/generated/model',
|
||
|
|
client: 'axios',
|
||
|
|
override: {
|
||
|
|
mutator: {
|
||
|
|
path: 'src/api/generated/mutator.ts',
|
||
|
|
name: 'customMutator',
|
||
|
|
},
|
||
|
|
// 自定义类型名称
|
||
|
|
name: (type) => {
|
||
|
|
// 移除命名空间前缀,简化类型名称
|
||
|
|
return type.replace(/^(Result|ResultPageResult)/, '');
|
||
|
|
},
|
||
|
|
},
|
||
|
|
// 导入优化
|
||
|
|
imports: {
|
||
|
|
axios: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
input: {
|
||
|
|
// 从后端 Swagger 文档生成
|
||
|
|
target: 'http://localhost:3000/api-docs-json',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|