Performance: DTO class creation
LOW IMPACT
This affects the bundle size and initial load time by adding extra code for data validation and transformation.
import { IsString, IsInt, Min, Max } from 'class-validator'; export class CreateUserDto { @IsString() name: string; @IsInt() @Min(0) @Max(120) age: number; }
import { IsString, IsInt, Min, Max } from 'class-validator'; export class CreateUserDto { @IsString() name: string; @IsInt() @Min(0) @Max(120) age: number; @IsString() bio: string; @IsString() extraLargeField: string; // very large string field not always needed }
| Pattern | Bundle Size Impact | Execution Time | Validation Complexity | Verdict |
|---|---|---|---|---|
| Large DTO with many validations and fields | High (~5kb+) | High (10-15ms blocking) | Complex | [X] Bad |
| Minimal DTO with essential validations only | Low (~1-2kb) | Low (2-5ms blocking) | Simple | [OK] Good |