Angular v20 Plugin

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. 🎉

js

export default {
  input: 'hey-api/backend', // sign up at app.heyapi.dev
  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.

ts

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

js

export default {
  input: 'hey-api/backend', // sign up at app.heyapi.dev
  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.

ts

export const addPetResource = (options) => httpResource(() => addPetRequest(options()));

js

export default {
  input: 'hey-api/backend', // sign up at app.heyapi.dev
  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.

Hey API is sponsor-funded. If you rely on Hey API in production, consider becoming a sponsor to accelerate the roadmap.