first commit

This commit is contained in:
2026-02-26 09:25:47 +08:00
commit 40665dda67
708 changed files with 100122 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import type {GenerateServiceProps} from 'openapi-ts-request'
// 将路径转换为大驼峰命名
function pathToCamelCase(path: string): string {
return path
.split('/')
.filter(segment => segment && segment !== '')
.map(segment => segment.charAt(0).toUpperCase() + segment.slice(1))
.join('')
}
export default [
{
schemaPath: 'http://127.0.0.1:4523/export/openapi/4?version=3.0',
serversPath: './src/service',
requestLibPath: `import request from '@/http/vue-query';\n import type { CustomRequestOptions } from '@/http/types'`,
requestOptionsType: 'CustomRequestOptions',
isGenReactQuery: false,
reactQueryMode: 'vue',
isGenJavaScript: false,
hook: {
// 自定义接口名称生成规则
customFunctionName: (data: any) => {
const {path, method} = data
// 将路径转换为大驼峰,然后加上请求方法
const camelCasePath = pathToCamelCase(path)
const methodSuffix = method.charAt(0).toUpperCase() + method.slice(1).toLowerCase()
return `${camelCasePath}${methodSuffix}`
}
}
},
] as GenerateServiceProps[]