Validator function for the "max" constraint.