Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1stack specificStack: node
nestjsdtovalidationswaggertypescript
Give NestJS DTO members access modifiers, validators, and @ApiProperty
Every DTO property should have an explicit access modifier, a class-validator decorator (required/optional), and an @ApiProperty for Swagger docs.
PR: profico-mining-2026-06Created: Jul 26, 2026
Bad example
Old codetypescript
| 1 | export class TaskDto { title: string; done?: boolean; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | export class TaskDto { |
| 2 | @ApiProperty() @IsString() public title: string; |
| 3 | @ApiProperty({ required: false }) @IsOptional() @IsBoolean() public done?: boolean; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)