Validating array properties is made easy with the
.ruleForEach method works almost exactly the same as the
.ruleFor method, so it's worth reading up on that first if you haven't already.
You can validate an array property using the
this.ruleFor('scores').must( scores => scores.filter(score => score < 0 || score > 100).length === 0 );
Alternatively, you can use the
this.ruleForEach('scores') .greaterThanOrEqualTo(0) .lessThanOrEqualTo(100);