Validation only succeeds if all passed in validators return no errors
335743
def all(*validators):
    """"""
    def validate_all(fields):
        for validator in validators:
            errors = validator(fields)
            if errors:
                return errors

    validate_all.__doc__ = " and ".join(validator.__doc__ for validator in validators)
    return validate_all
1369312
function valueIsNullForValidator(value, validatorName) {
  if (value === null || value === CONSTANT.NULL || typeof value === 'undefined') {
    return true;
  }

  if (value === '' && VALIDATOR_CONSIDERS_EMPTY_STRING_NULL[validatorName]) {
    return true;
  }

  return false;
}
549860
public void validate(final List<Throwable> validationErrors) {
        if (this.matchers == null) {
            validationErrors.add(new IllegalArgumentException(
                    "Matchers cannot be null.  There should be at least a !acceptAll matcher"));
        }
        if (this.matchers != null && this.matchers.isEmpty()) {
            validationErrors.add(new IllegalArgumentException(
                    "There are no url matchers defined.  There should be at least a " +
                            "!acceptAll matcher"));
        }
    }
71347
def play_all_validators(self, validators, value):
        
        successes = list()
        failures = OrderedDict()
        for validator in validators:
            name = get_callable_name(validator)
            try:
                res = validator(value)
                if result_is_success(res):
                    successes.append(name)
                else:
                    failures[validator] = res

            except Exception as exc:
                failures[validator] = exc

        return successes, failures
49235
def validate_json(data, validator):
    
    errors = []
    for err in sorted(validator.iter_errors(data), key=lambda e: e.path):
        if err.path:
            err_path = "[{}]".format(" -> ".join([str(p) for p in err.path]))
        else:
            err_path = ""
        msg = err.message + " " + err_path
        if err.context:  # Error has suberrors, e.g. if schema uses anyOf
            suberrs = ["  - {}".format(suberr.message) for suberr in err.context]
            msg += ":\n{}".format("".join(suberrs))
        errors.append(msg)
    return errors
898954
private Validator<ValueType> validateLeft() {
        Validator<ValueType> result = null;
        Collection<Validator<ValueType>> subValidators = onGetLeftErrorMessage();

        if (subValidators != null) {
            for (Validator<ValueType> validator : subValidators) {
                notifyOnValidationFailure(validator);

                if (result == null) {
                    result = validator;
                }
            }
        }

        for (Validator<ValueType> validator : validators) {
            if (!validator.validate(getValue())) {
                notifyOnValidationFailure(validator);

                if (result == null) {
                    result = validator;
                }
            }
        }

        return result;
    }
526271
def valid?
      status_validator = EnumAttributeValidator.new('String', ["pending", "transfering", "queued", "downloading", "uploading", "processing", "success", "error"])
      return false unless status_validator.valid?(@status)
      type_validator = EnumAttributeValidator.new('String', ["vidchecker", "lipsync"])
      return false unless type_validator.valid?(@type)
      return true
    end
117483
function validator(value, next) {
    validationErrors = [];
    var isValid = true;

    validatorsArray.forEach(function(validator) {
      validator.validator.call(this, value, function(valid) {
        if (!valid) {
          // Append message
          validationErrors.push(validator.message);

          isValid = false;
        }
      });
    }.bind(this));
    return next(isValid);
  }
964887
def _validate(self, validator, data, key, position=None, includes=None):
        
        errors = []

        if position:
            position = '%s.%s' % (position, key)
        else:
            position = key

        try:  # Pull value out of data. Data can be a map or a list/sequence
            data_item = util.get_value(data, key)
        except KeyError:  # Oops, that field didn't exist.
            if validator.is_optional:  # Optional? Who cares.
                return errors
            # SHUT DOWN EVERTYHING
            errors.append('%s: Required field missing' % position)
            return errors

        return self._validate_item(validator, data_item, position, includes)
1183268
def __parse_validators(self):
        """"""
        self._validators = []
        validators_json = self._options.get('validators')
        for validator_json in validators_json:
            self._validators.append(PropertyValidator.parse(json=validator_json))
52065
def validate(self, value=None, model=None, context=None):
        
        errors = []
        for validator in self.validators:
            if value is None and not isinstance(validator, Required):
                continue

            error = validator.run(
                value=value,
                model=model,
                context=context if self.use_context else None
            )
            if error:
                errors.append(error)

        return errors
1356463
def validate
      errors = {}

      call_validators do |name, message|
        errors[name] ||= []
        errors[name] << to_error(message)
      end

      errors
    end
665132
@Override
	protected void validateComponent(final List<Diagnostic> diags) {
		super.validateComponent(diags);

		String[] values = getValue();

		if (values != null) {
			int max = getMaxLength();
			int min = getMinLength();
			Pattern pattern = getComponentModel().pattern;

			for (String value : values) {
				boolean invalid = false;

				if (Util.empty(value)) {
					continue;
				}

				// Minimum Length
				if (min > 0 && value.length() < min) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MIN_LENGTH, this,
							String.valueOf(min)));
					invalid = true;
				}

				// Maximum Length
				if (max > 0 && value.length() > max) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MAX_LENGTH, this,
							String.valueOf(max)));
					invalid = true;
				}

				// Pattern
				if (pattern != null) {
					Matcher matcher = pattern.matcher(value);
					if (!matcher.matches()) {
						diags.add(createErrorDiagnostic(
								InternalMessages.DEFAULT_VALIDATION_ERROR_INVALID_PATTERN, this));
						invalid = true;
					}
				}

				// Only report the first invalid item
				if (invalid) {
					break;
				}
			}
		}
	}
1063653
def _run_validators(self, value):
        
        if value in self.empty_values:
            return

        errors = []
        for validator in self.validators:
            try:
                validator(value)
            except exceptions.ValidationError as err:
                if isinstance(err.messages, dict):
                    errors.append(err.messages)
                else:
                    errors.extend(err.messages)

        if errors:
            raise exceptions.ValidationError(errors)
783130
def run_validators(new_data, old_data):
    
    #{'validator_name': (success, score, message)}
    validation_data = {}
    for file_type, lint_data in list(new_data.items()):
        #TODO: What to do if old data doesn't have this filetype?
        old_lint_data = old_data.get(file_type, {})
        validator = ValidatorFactory.get_validator(file_type)
        if validator is not None:
            validation_data[validator.name] = validator.run(lint_data, old_lint_data)
    return validation_data
367128
@Override
  public void validate(T arg) throws ValidationException {
    for (final Validator<T> validator : validators) {
      validator.validate(arg);
    }
  }
1162038
def validate(self):
        
        validator = Draft7Validator(self.SCHEMA)

        errors = set()  # make errors a set to avoid duplicates

        for error in validator.iter_errors(self.serialize()):
            errors.add('.'.join(
                list(map(str, error.path)) + [error.message]
            ))

        if errors:
            raise JSONValidationException(type(self).__name__, errors)