Files
o2o-weather/admin/openapi-ts.config.ts
T

23 lines
794 B
TypeScript

import { defineConfig } from '@hey-api/openapi-ts'
export default defineConfig({
input: process.env.OPENAPI_INPUT ?? 'http://localhost:9810/openapi.json',
output: 'src/api/client',
parser: {
patch: {
// FastAPI operationId("get_feed_v1_feed_get")에서 "_v1_" 앞만 camelCase로 → getFeed / getFeedOptions / addCommentMutation
operations: (_method, _path, operation) => {
const id = operation.operationId ?? ''
const base = id.split('_v1_')[0] || id
operation.operationId = base.replace(/_([a-z])/g, (_m, c: string) => c.toUpperCase())
},
},
},
plugins: [
{ name: '@hey-api/client-fetch', throwOnError: true },
{ name: '@hey-api/typescript', enums: 'javascript' },
'@hey-api/sdk',
'@tanstack/react-query',
],
})