Angular v20
WARNING
Angular client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on GitHub.
About
Angular is a web framework that empowers developers to build fast, reliable applications.
The Angular plugin for Hey API generates HTTP requests and resources from your OpenAPI spec, fully compatible with validators, transformers, and all core features.
Collaborators
Features
- Angular v20 support
- seamless integration with
@hey-api/openapi-ts
ecosystem - generate HTTP requests
- generate HTTP resources
- minimal learning curve thanks to extending the underlying technology
Installation
In your configuration, add @angular/common
to your plugins and you'll be ready to generate Angular artifacts. 🎉
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: 'src/client',
plugins: [
// ...other plugins
'@angular/common',
],
};
Output
The Angular plugin will generate the following artifacts, depending on the input specification.
Requests
A single function is generated for each endpoint. It returns an HttpRequest
result.
export const addPetRequest = (options) =>
client.requestOptions({
method: 'POST',
responseStyle: 'data',
url: '/pet',
...options,
});
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: 'src/client',
plugins: [
// ...other plugins
{
name: '@angular/common',
httpRequests: true,
},
],
};
Resources
A single function is generated for each endpoint. It returns a result from httpResource
call.
export const addPetResource = (options) =>
httpResource(() => addPetRequest(options()));
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: 'src/client',
plugins: [
// ...other plugins
{
name: '@angular/common',
httpResources: true,
},
],
};
API
You can view the complete list of options in the UserConfig interface.
Examples
You can view live examples on StackBlitz.
Sponsors
Help Hey API stay around for the long haul by becoming a sponsor.