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

NestJSv11

v11

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

Nest is a progressive Node.js framework for building efficient, reliable and scalable server-side applications.

The NestJS plugin for Hey API generates type-safe controller method signatures from your OpenAPI spec, fully compatible with all core features.

  • NestJS v11 support
  • seamless integration with @hey-api/openapi-ts ecosystem
  • type-safe controller methods
  • minimal learning curve thanks to extending the underlying technology

In your configuration, add nestjs to your plugins and you’ll be ready to generate NestJS artifacts. 🎉

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

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

Operations are grouped by their first tag into separate types.

nestjs.gen.ts
export type PetsControllerMethods = {
createPet: (body: CreatePetData['body']) => Promise<CreatePetResponse>;
listPets: (query?: ListPetsData['query']) => Promise<ListPetsResponse>;
showPetById: (path: ShowPetByIdData['path']) => Promise<ShowPetByIdResponse>;
};
export type StoreControllerMethods = {
getInventory: () => Promise<GetInventoryResponse>;
};

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

Examples

You can view live examples on StackBlitz or on GitHub.