-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Expand file tree
/
Copy pathopenapi-ts.config.ts
More file actions
33 lines (29 loc) · 813 Bytes
/
openapi-ts.config.ts
File metadata and controls
33 lines (29 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { defineConfig } from "@hey-api/openapi-ts"
export default defineConfig({
input: "./openapi.json",
output: "./src/client",
plugins: [
"legacy/axios",
{
name: "@hey-api/sdk",
// NOTE: this doesn't allow tree-shaking
asClass: true,
operationId: true,
classNameBuilder: "{{name}}Service",
methodNameBuilder: (operation) => {
// @ts-expect-error
let name: string = operation.name
// @ts-expect-error
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)
},
},
{
name: "@hey-api/schemas",
type: "json",
},
],
})