Legacy Clients
Before standalone client packages, clients were generated using @hey-api/openapi-ts
. In fact, @hey-api/openapi-ts
still supports generating legacy clients. You can generate them with the client
config option.
js
export default {
client: 'fetch',
input: 'path/to/openapi.json',
output: 'src/client',
}
js
export default {
client: 'axios',
input: 'path/to/openapi.json',
output: 'src/client',
}
js
export default {
client: 'angular',
input: 'path/to/openapi.json',
output: 'src/client',
}
js
export default {
client: 'node',
input: 'path/to/openapi.json',
output: 'src/client',
}
js
export default {
client: 'xhr',
input: 'path/to/openapi.json',
output: 'src/client',
}
Available Clients
Caveats
Please be aware that legacy clients are missing some key features:
- no typesafe errors 🚫
- no access to the original request and response 🚫
- hard to configure individual requests 👎
- inconsistent interceptors and response APIs 👎
TIP
You might not need a node
client. Fetch API is experimental in Node.js v18 and stable in Node.js v21. We recommend upgrading to the latest Node.js version.
Examples
You can view live examples on StackBlitz.