Command a resource to populate its ViolationSet with any violations of
 its validation Rules in +context_name+

 @api public
433602
def validate(context_name = default_validation_context)
      errors.clear
      validation_violations(context_name).each { |v| errors.add(v) }

      self
    end
886139
def full_messages
      violations.inject([]) do |list, (attribute_name, violations)|
        messages = violations
        messages = violations.full_messages if violations.respond_to?(:full_messages)
        list.concat(messages)
      end
    end
116987
def run_validators(self, value):
        
        errors = []
        for validator in self.validators:
            if hasattr(validator, 'set_context'):
                validator.set_context(self)

            try:
                validator(value)
            except ValidationError as exc:
                # If the validation error contains a mapping of fields to
                # errors then simply raise it immediately rather than
                # attempting to accumulate a list of errors.
                if isinstance(exc.detail, dict):
                    raise
                errors.extend(exc.detail)
            except DjangoValidationError as exc:
                errors.extend(exc.messages)
        if errors:
            raise ValidationError(errors)
55734
private void validateCommandResult(DockerCommand command, TestContext context) {
        if (log.isDebugEnabled()) {
            log.debug("Starting Docker command result validation");
        }

        if (StringUtils.hasText(expectedCommandResult)) {
            if (command.getCommandResult() == null) {
                throw new ValidationException("Missing Docker command result");
            }

            try {
                String commandResultJson = jsonMapper.writeValueAsString(command.getCommandResult());
                JsonMessageValidationContext validationContext = new JsonMessageValidationContext();
                jsonTextMessageValidator.validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(expectedCommandResult), context, validationContext);
                log.info("Docker command result validation successful - all values OK!");
            } catch (JsonProcessingException e) {
                throw new CitrusRuntimeException(e);
            }
        }

        if (command.getResultCallback() != null) {
            command.getResultCallback().doWithCommandResult(command.getCommandResult(), context);
        }
    }
1132448
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var withscores;
  if(args.length > 3) {
    withscores = ('' + args[3]).toLowerCase();
    if(withscores !== Constants.ZSET.WITHSCORES) {
      throw CommandSyntax;
    }
    args[3] = withscores;
  }
}
1363074
function(model, name) {
                if (!model.resource) {
                    return;
                }

                var resource = model.resource.replace(/\/+$/, "");
                if (name === "findAll" || name === "create") {
                    return resource;
                } else {
                    return resource + "/{" + model.id + "}";
                }
            }
193842
def get_violation_if_found(self, node, lint_context):
        
        if self.is_valid(node, lint_context):
            return None

        return self.create_violation_report(node, lint_context)
209547
function validateBoolean(context, name, def) {
  var value = context[name]

  if (value == null) {
    value = def
  }

  if (typeof value !== 'boolean') {
    raise(value, 'options.' + name)
  }

  context[name] = value
}
232168
def validate_context(self, context):
        
        return all(
            [
                hasattr(context, attr)
                for attr in [
                    "aws_request_id",
                    "function_name",
                    "function_version",
                    "get_remaining_time_in_millis",
                    "invoked_function_arn",
                    "log_group_name",
                    "log_stream_name",
                    "memory_limit_in_mb",
                ]
            ]
        ) and callable(context.get_remaining_time_in_millis)
342226
def list(name,
             loader = nil,
             enforce_element: @enforce_all_elements,
             enforce_values: true,
             exact_count: nil,
             max_count: nil,
             min_count: nil,
             required: nil,
             with_elements: false)

      enforce_element = required unless required.nil?
      enforce_element ||= exact_count && exact_count > 0 || min_count && min_count > 0
      loader = Proc.new if block_given?

      @touched = true

      unless @elements_associative.key?(name)
        if enforce_element
          raise Errors::Validation.missing_list(@context, name, @instruction)
        end

        return []
      end

      elements = @elements_associative[name]

      elements.each do |element|
        case element
        when List, Empty
          next
        when Field
          raise Errors::Validation.expected_list_got_field(@context, element.instruction)
        when Fieldset
          raise Errors::Validation.expected_list_got_fieldset(@context, element.instruction)
        when Section
          raise Errors::Validation.expected_list_got_section(@context, element.instruction)
        end
      end

      if elements.length > 1
        raise Errors::Validation.expected_list_got_lists(
          @context,
          name,
          elements.map(&:instruction)
        )
      end

      element = elements[0]
      element.touch

      count = element.is_a?(Empty) ? 0 : element.length

      if exact_count && count != exact_count
        raise Errors::Validation.exact_count_not_met(@context, element.instruction, exact_count)
      end

      if min_count && count < min_count
        raise Errors::Validation.min_count_not_met(@context, element.instruction, min_count)
      end

      if max_count && count > max_count
        raise Errors::Validation.max_count_not_met(@context, element.instruction, max_count)
      end

      if element.is_a?(Empty)
        []
      else
        element.items(loader, enforce_values: enforce_values, with_elements: with_elements)
      end
    end
1334542
def validate(cls, partial=True, **kwargs):
        
        data = kwargs
        if not partial:
            data = dict(**kwargs, **{col.name: None for col in cls.__table__.c
                                     if col.name not in kwargs})

        errors = defaultdict(list)
        for name, value in data.items():
            for validator in cls._get_validators(name):
                try:
                    validator(value)
                except ValidationError as e:
                    e.model = cls
                    e.column = name
                    errors[name].append(str(e))

        if errors:
            raise ValidationErrors(errors)
816248
def validate(context = Attributor::DEFAULT_ROOT_CONTEXT)
      raise AttributorException, 'validation conflict' if @validating
      @validating = true

      context = [context] if context.is_a? ::String
      keys_with_values = []
      errors = []

      self.class.attributes.each do |sub_attribute_name, sub_attribute|
        sub_context = self.class.generate_subcontext(context, sub_attribute_name)

        value = __send__(sub_attribute_name)
        keys_with_values << sub_attribute_name unless value.nil?

        if value.respond_to?(:validating) # really, it's a thing with sub-attributes
          next if value.validating
        end

        errors.concat sub_attribute.validate(value, sub_context)
      end
      self.class.requirements.each do |req|
        validation_errors = req.validate(keys_with_values, context)
        errors.concat(validation_errors) unless validation_errors.empty?
      end

      errors
    ensure
      @validating = false
    end
590095
function(command, argument) {
		/// <summary>
		/// Return the validations rules for the first selected element.
		/// </summary>
		/// <param name="command" type="String">
		/// Can be either "add" or "remove".
		/// </param>
		/// <param name="argument" type="">
		/// A list of rules to add or remove.
		/// </param>

		var element = this[0];
		
		if (command) {
			var settings = $.data(element.form, 'validator').settings;
			var staticRules = settings.rules;
			var existingRules = $.validator.staticRules(element);
			switch(command) {
			case "add":
				$.extend(existingRules, $.validator.normalizeRule(argument));
				staticRules[element.name] = existingRules;
				if (argument.messages)
					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
				break;
			case "remove":
				if (!argument) {
					delete staticRules[element.name];
					return existingRules;
				}
				var filtered = {};
				$.each(argument.split(/\s/), function(index, method) {
					filtered[method] = existingRules[method];
					delete existingRules[method];
				});
				return filtered;
			}
		}
		
		var data = $.validator.normalizeRules(
		$.extend(
			{},
			$.validator.metadataRules(element),
			$.validator.classRules(element),
			$.validator.attributeRules(element),
			$.validator.staticRules(element)
		), element);
		
		// make sure required is at front
		if (data.required) {
			var param = data.required;
			delete data.required;
			data = $.extend({required: param}, data);
		}
		
		return data;
	}
943952
def validate_resource(resource) -> None:
    """"""
    if resource is not None and not isinstance(resource, dict):
        raise ValidationError('The resource is not valid.')

    if isinstance(resource, dict) and set(resource.keys()) <= {'requests', 'limits'}:
        raise ValidationError(
            'The keys `{}` for the resource are not valid.'.format(set(resource.keys())))
890549
function createRuleListeners(rule, ruleContext) {
    try {
        return rule.create(ruleContext);
    } catch (ex) {
        ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`;
        throw ex;
    }
}
377142
def validate(self):
        
        if not self.editable:
            assert self.populate_from is not NotSet, u"If field (%s) is not editable, you must set populate_from" % self.name
514286
def validate(object, context = Attributor::DEFAULT_ROOT_CONTEXT)
      raise "INVALID CONTEXT!! #{context}" unless context
      # Validate any requirements, absolute or conditional, and return.

      if object.nil? # == Attributor::UNSET
        # With no value, we can only validate whether that is acceptable or not and return.
        # Beyond that, no further validation should be done.
        return validate_missing_value(context)
      end

      # TODO: support validation for other types of conditional dependencies based on values of other attributes

      errors = validate_type(object, context)

      # End validation if we don't even have the proper type to begin with
      return errors if errors.any?

      if options[:values] && !options[:values].include?(object)
        errors << "Attribute #{Attributor.humanize_context(context)}: #{Attributor.errorize_value(object)} is not within the allowed values=#{options[:values].inspect} "
      end

      errors + type.validate(object, context, self)
    end