← full-stack-fastapi-template / frontend/openapi-ts.config.ts
| 1 | import { defineConfig } from "@hey-api/openapi-ts" |
| 2 | |
| 3 | export default defineConfig({ |
| 4 | input: "./openapi.json", |
| 5 | output: "./src/client", |
| 6 | |
| 7 | plugins: [ |
| 8 | "legacy/axios", |
| 9 | { |
| 10 | name: "@hey-api/sdk", |
| 11 | // NOTE: this doesn't allow tree-shaking |
| 12 | asClass: true, |
| 13 | operationId: true, |
| 14 | classNameBuilder: "{{name}}Service", |
| 15 | methodNameBuilder: (operation) => { |
| 16 | // @ts-expect-error |
| 17 | let name: string = operation.name |
| 18 | // @ts-expect-error |
| 19 | const service: string = operation.service |
| 20 | |
| 21 | if (service && name.toLowerCase().startsWith(service.toLowerCase())) { |
| 22 | name = name.slice(service.length) |
| 23 | } |
| 24 | |
| 25 | return name.charAt(0).toLowerCase() + name.slice(1) |
| 26 | }, |
| 27 | }, |
| 28 | { |
| 29 | name: "@hey-api/schemas", |
| 30 | type: "json", |
| 31 | }, |
| 32 | ], |
| 33 | }) |
| 34 |