NestJS · Junior · Question 56 of 75
How do you generate OpenAPI (Swagger) docs in Nest?
- 1Nest generates docs only in production
- 2Write the YAML file by hand; there's no integration
- ✓Correct answer: With
@nestjs/swagger: build a document withDocumentBuilderand serve it withSwaggerModule.setup()
Explanation
Decorators like @ApiProperty() describe DTOs; the Swagger CLI plugin can infer many of them from TypeScript types.