跳转到内容
Host your specs. Generate from anywhere.

Angularv20

v20

此内容尚不支持你的语言。

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.

  • 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

In your configuration, add @angular/common to your plugins and you’ll be ready to generate Angular artifacts. 🎉

openapi-ts.config.ts
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
plugins: [
// ...other plugins
'@angular/common',
],
};

The Angular plugin will generate the following artifacts, depending on the input specification.

A single function is generated for each endpoint. It returns an HttpRequest result.

common.gen.ts
export const addPetRequest = (options) =>
client.requestOptions({
method: 'POST',
responseStyle: 'data',
url: '/pet',
...options,
});

A single function is generated for each endpoint. It returns a result from httpResource call.

common.gen.ts
export const addPetResource = (options) => httpResource(() => addPetRequest(options()));

You can view the complete list of options in the UserConfig interface.

Examples

You can view live examples on StackBlitz or on GitHub.