Performance: Nested DTO validation
MEDIUM IMPACT
This affects server response time and initial API processing speed by adding validation overhead.
class AddressDto { @IsString() street: string; @IsString() city: string; } class UserDto { @IsString() name: string; @ValidateNested({ each: true }) @Type(() => AddressDto) @ArrayMaxSize(5) addresses: AddressDto[]; } // Validation pipe with transform: true and whitelist: true enabled
class AddressDto { @IsString() street: string; @IsString() city: string; } class UserDto { @IsString() name: string; @ValidateNested({ each: true }) @Type(() => AddressDto) addresses: AddressDto[]; } // Validation pipe used globally without whitelist or transform options
| Pattern | CPU Usage | Memory Usage | Response Latency | Verdict |
|---|---|---|---|---|
| Deep nested DTO without limits | High | High | Increased by 50-100ms | [X] Bad |
| Nested DTO with array size limits and transform | Medium | Medium | Reduced by 30-50% | [OK] Good |