nest-responses-generator-plugin
v0.0.2
Published
NestJS plugin that automatically generates Swagger response JSON examples from service's return types
Maintainers
Readme
@nest-responses-generator/plugin
🚀 NestJS plugin that automatically generates Swagger response types from service return types
This is the core plugin package for the NestJS Response Generator. It provides automatic generation of OpenAPI/Swagger response specifications based on inferred types from your service functions.
Installation
npm install @nest-responses-generator/pluginQuick Setup
- Add to your
nest-cli.json:
{
"compilerOptions": {
"plugins": [
{
"name": "@nest-responses-generator/plugin",
"options": {
"outputDir": "src/generated",
"servicePattern": "**/*.service.ts",
"controllerPattern": "**/*.controller.ts",
"clean": false
}
}
]
}
}- Use the generated responses in your controllers:
import { AutoResponse } from '@nest-responses-generator/plugin';
@Controller('users')
export class UsersController {
@Get()
@AutoResponse('UsersServiceFindAllResponseItem')
findAll() {
return this.usersService.findAll();
}
}Documentation
For complete documentation, examples, and usage guides, see the main repository.
Features
- ✅ Zero duplication - no need to write separate response DTOs
- ✅ Automatic build-time generation
- ✅ Full TypeScript support
- ✅ Smart decorator system
- ✅ Rich Swagger documentation
License
MIT
