Files
fast_api_template/frontend/openapi-ts.config.ts
T

34 lines
813 B
TypeScript
Raw Normal View History

2024-11-27 12:06:59 +01:00
import { defineConfig } from "@hey-api/openapi-ts"
export default defineConfig({
input: "./openapi.json",
output: "./src/client",
2024-11-27 12:06:59 +01:00
plugins: [
"legacy/axios",
2024-11-27 12:06:59 +01:00
{
name: "@hey-api/sdk",
// NOTE: this doesn't allow tree-shaking
asClass: true,
operationId: true,
classNameBuilder: "{{name}}Service",
methodNameBuilder: (operation) => {
2025-09-09 14:45:10 +02:00
// @ts-expect-error
let name: string = operation.name
2025-09-09 14:45:10 +02:00
// @ts-expect-error
2025-02-17 19:33:00 +00:00
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)
},
2024-11-27 12:06:59 +01:00
},
{
name: "@hey-api/schemas",
type: "json",
},
2024-11-27 12:06:59 +01:00
],
2025-09-09 14:45:10 +02:00
})