29 lines
724 B
TypeScript
29 lines
724 B
TypeScript
import { defineConfig } from "@hey-api/openapi-ts"
|
|
|
|
export default defineConfig({
|
|
client: "legacy/axios",
|
|
input: "./openapi.json",
|
|
output: "./src/client",
|
|
// exportSchemas: true,
|
|
plugins: [
|
|
{
|
|
name: "@hey-api/sdk",
|
|
// NOTE: this doesn't allow tree-shaking
|
|
asClass: true,
|
|
operationId: true,
|
|
methodNameBuilder: (operation) => {
|
|
// @ts-ignore
|
|
let name: string = operation.name
|
|
// @ts-ignore
|
|
const service: string = operation.service
|
|
|
|
if (service && name.toLowerCase().startsWith(service.toLowerCase())) {
|
|
name = name.slice(service.length)
|
|
}
|
|
|
|
return name.charAt(0).toLowerCase() + name.slice(1)
|
|
},
|
|
},
|
|
],
|
|
})
|