Use the each: true option on any decorator to apply it per array item. Use @ValidateIf(condition) for conditional validation — the decorator is entirely skipped when the condition returns false, so no error is thrown for undefined optional conditional fields.
each: true — applies the decorator to every element in the array individually.
@IsArray() — validates the property is an array before per-item checks run.
@ArrayMinSize(n) / @ArrayMaxSize(n) — length constraints on the array.
@ValidateIf(condition) — the validator is entirely skipped when condition returns false.
Combine @ValidateIf with @IsOptional when the field may also be absent entirely.