------------------------------
 Parameter validators
 Validates the +capability+ attribute in the specified metadata.
 @raise [ArgumentError] if the specified metadata does not have the correct +capability+ attribute for this list type.
331445
def metadata_with_correct_capability(metadata)
      capability = self.class::CAPABILITY
      raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
      return Metadata.new(capability: capability) unless metadata
      raise ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
      raise ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
      metadata
    end
631190
def validate_required_attributes!
      unless required_attributes?
        blank_attribute = required_attributes.detect { |attr| self[attr].nil? || self[attr].empty? }

        raise ValidationError, "#{blank_attribute} can't be blank"
      end
    end
1353860
def required_attributes
      validators.map{ |v| v.attributes if v.is_a?(Mongoid::Validations::PresenceValidator) }.flatten.compact
    end
888089
def status=(status)
      validator = EnumAttributeValidator.new('String', ["pending", "preparing", "processing", "success", "error"])
      unless validator.valid?(status)
        fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
      end
      @status = status
    end
277619
def cleared=(cleared)
      validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
      unless validator.valid?(cleared)
        fail ArgumentError, 'invalid value for "cleared", must be one of #{validator.allowable_values}.'
      end
      @cleared = cleared
    end
706136
def validate_python_identifier_attributes(fully_qualified_name: str, spec: Dict[str, Any],
                                          *attributes: str) -> List[InvalidIdentifierError]:
    
    errors: List[InvalidIdentifierError] = []

    checks: List[Tuple[Callable, InvalidIdentifierError.Reason]] = [
        (lambda x: x.startswith('_'), InvalidIdentifierError.Reason.STARTS_WITH_UNDERSCORE),
        (lambda x: x.startswith('run_'), InvalidIdentifierError.Reason.STARTS_WITH_RUN),
        (lambda x: not x.isidentifier(), InvalidIdentifierError.Reason.INVALID_PYTHON_IDENTIFIER),
    ]

    for attribute in attributes:
        if attribute not in spec or spec.get(ATTRIBUTE_INTERNAL, False):
            continue

        for check in checks:
            if check[0](spec[attribute]):
                errors.append(
                    InvalidIdentifierError(fully_qualified_name, spec, attribute, check[1]))
                break

    return errors
1181965
def capability(cap_name, *args)
      cap_mod = capability_module(cap_name.to_sym)
      if !cap_mod
        raise Errors::CapabilityNotFound,
          cap:  cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      cap_method = nil
      begin
        cap_method = cap_mod.method(cap_name)
      rescue NameError
        raise Errors::CapabilityInvalid,
          cap: cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      args = @cap_args + args
      @cap_logger.info(
        "Execute capability: #{cap_name} #{args.inspect} (#{@cap_host_chain[0][0]})")
      cap_method.call(*args)
    end
1293484
def _validate(self, sam_template, parameter_values):
        
        if parameter_values is None:
            raise ValueError("`parameter_values` argument is required")

        if ("Resources" not in sam_template or not isinstance(sam_template["Resources"], dict) or not
                sam_template["Resources"]):
            raise InvalidDocumentException(
                [InvalidTemplateException("'Resources' section is required")])

        if (not all(isinstance(sam_resource, dict) for sam_resource in sam_template["Resources"].values())):
            raise InvalidDocumentException(
                [InvalidTemplateException(
                    "All 'Resources' must be Objects. If you're using YAML, this may be an "
                    "indentation issue."
                )])

        sam_template_instance = SamTemplate(sam_template)

        for resource_logical_id, sam_resource in sam_template_instance.iterate():
            # NOTE: Properties isn't required for SimpleTable, so we can't check
            # `not isinstance(sam_resources.get("Properties"), dict)` as this would be a breaking change.
            # sam_resource.properties defaults to {} in SamTemplate init
            if (not isinstance(sam_resource.properties, dict)):
                raise InvalidDocumentException(
                    [InvalidResourceException(resource_logical_id,
                                              "All 'Resources' must be Objects and have a 'Properties' Object. If "
                                              "you're using YAML, this may be an indentation issue."
                                              )])

        SamTemplateValidator.validate(sam_template)
1066144
def valid?
      sort_validator = EnumAttributeValidator.new('String', ["COUNT", "INDEX"])
      return false unless sort_validator.valid?(@sort)
      method_validator = EnumAttributeValidator.new('String', ["ENUM", "FC"])
      return false unless method_validator.valid?(@method)
      return true
    end
974983
def attribute_required?(attribute)
      validator = find_validator(attribute, ActiveModel::Validations::PresenceValidator) ||
                  find_validator(attribute, TranslatablePresenceValidator)

      return unless validator

      # Check if the if condition is present and it evaluates to true
      if_condition = validator.options[:if]
      validator_if_condition = if_condition.nil? ||
                               (string_or_symbol?(if_condition) ? object.send(if_condition) : if_condition.call(object))

      # Check if the unless condition is present and it evaluates to false
      unless_condition = validator.options[:unless]
      validator_unless_condition = unless_condition.nil? ||
                                   (string_or_symbol?(unless_condition) ? !object.send(unless_condition) : !unless_condition.call(object))

      validator_if_condition && validator_unless_condition
    end
435522
def valid?
      return false if @id.nil?
      return false if @name.nil?
      authenticator_validator = EnumAttributeValidator.new('String', ["local", "ldap"])
      return false unless authenticator_validator.valid?(@authenticator)
      return true
    end
1223971
def _add_parameterized_validator_internal(param_validator, base_tag):
    ""
    add_parameterized_validator(param_validator, base_tag, tag_prefix=u'!~~%s(' % param_validator.__name__)
628933
def valid?
      return false if @name.nil?
      acl_validator = EnumAttributeValidator.new('String', ["public", "private"])
      return false unless acl_validator.valid?(@acl)
      return true
    end
595562
def inclusion_type=(inclusion_type)
      validator = EnumAttributeValidator.new('String', ["ADDITIVE", "INCLUSIVE"])
      unless validator.valid?(inclusion_type)
        fail ArgumentError, "invalid value for 'inclusion_type', must be one of #{validator.allowable_values}."
      end
      @inclusion_type = inclusion_type
    end
638652
def valid?
      return false if @is_valid.nil?
      match_type_validator = EnumAttributeValidator.new('String', ["Exact", "StartsWith", "EndsWith", "Contains"])
      return false unless match_type_validator.valid?(@match_type)
      return true
    end
1307418
public void validate(CFMetaData metadata) {
        for (Map.Entry<String, ColumnMapper> entry : columnMappers.entrySet()) {

            String name = entry.getKey();
            ColumnMapper columnMapper = entry.getValue();
            ByteBuffer columnName = UTF8Type.instance.decompose(name);

            ColumnDefinition columnDefinition = metadata.getColumnDefinition(columnName);
            if (columnDefinition == null) {
                throw new RuntimeException("No column definition for mapper " + name);
            }

            if (columnDefinition.isStatic()) {
                throw new RuntimeException("Lucene indexes are not allowed on static columns as " + name);
            }

            AbstractType<?> type = columnDefinition.type;
            if (!columnMapper.supports(type)) {
                throw new RuntimeException(String.format("Type '%s' is not supported by mapper '%s'", type, name));
            }
        }
    }
259279
def validate!(filter, names)
      unless filters.empty?
        raise InvalidFilterError, 'multiple filters in array block'
      end

      unless names.empty?
        raise InvalidFilterError, 'attribute names in array block'
      end

      if filter.default?
        raise InvalidDefaultError, 'default values in array block'
      end

      nil
    end