Validate the given field for OLAP constraints.
196349
private void validateField(FieldDefinition fieldDef) {
        if (fieldDef.isScalarField()) {
            Utils.require(Utils.isEmpty(fieldDef.getAnalyzerName()),
                          "'analyzer' not allowed for OLAPMono application fields:" + fieldDef);
        } else if (fieldDef.isXLinkField()) {
            Utils.require(false, "XLinks are not allowed for OLAPMono applications: " + fieldDef);
        } else if (fieldDef.isLinkField()) {
            Utils.require(!fieldDef.isSharded(),
                          "Link fields cannot be sharded: {}", fieldDef);
        }
    }
412570
def validate(self):
        
        for field_name, field_obj in self._fields.items():
            value = field_obj.__get__(self, self.__class__)

            if value is None and field_obj.null is False:
                raise ValidationError('Non-nullable field {0} is set to None'.format(field_name))
            elif value is None and field_obj.null is True:
                # no further validations are possible on NoneType field
                continue

            if isinstance(field_obj, NestedDocumentField):
                value.validate()
            else:
                field_obj.validate(value)
230110
def _validate_handler(column_name, value, predicate_refs):
    """"""

    # only does validate when attribute value is not None
    # else, just return it, let sqlalchemy decide if the value was legal according to `nullable` argument's value
    if value is not None:
        for predicate_ref in predicate_refs:
            predicate, predicate_name, predicate_args = _decode_predicate_ref(predicate_ref)
            validate_result = predicate(value, *predicate_args)

            if isinstance(validate_result, dict) and 'value' in validate_result:
                value = validate_result['value']
            elif type(validate_result) != bool:
                raise Exception(
                    'predicate (name={}) can only return bool or dict(value=new_value) value'.format(predicate_name))
            elif not validate_result:
                raise ModelInvalid(u'db model validate failed: column={}, value={}, predicate={}, arguments={}'.format(
                    column_name, value, predicate_name, ','.join(map(str, predicate_args))
                ))
    return value
525254
def validate(self):
        """"""
        if not isinstance(self.location, Location):
            raise TypeError(u'Expected Location location, got: {} {}'.format(
                type(self.location).__name__, self.location))

        if not self.location.field:
            raise ValueError(u'Expected Location object that points to a field, got: '
                             u'{}'.format(self.location))

        if not is_graphql_type(self.field_type):
            raise ValueError(u'Invalid value of "field_type": {}'.format(self.field_type))

        stripped_field_type = strip_non_null_from_type(self.field_type)
        if isinstance(stripped_field_type, GraphQLList):
            inner_type = strip_non_null_from_type(stripped_field_type.of_type)
            if GraphQLDate.is_same_type(inner_type) or GraphQLDateTime.is_same_type(inner_type):
                # This is a compilation error rather than a ValueError as
                # it can be caused by an invalid GraphQL query on an otherwise valid schema.
                # In other words, it's an error in writing the GraphQL query, rather than
                # a programming error within the library.
                raise GraphQLCompilationError(
                    u'Lists of Date or DateTime cannot currently be represented as '
                    u'OutputContextField objects: {}'.format(self.field_type))
705463
function validate (schema, data, key) {
  let value = data[key]
  const bool = value == null || value === ''
  const { required, type, validate, transform, elements } = schema
  const def = schema['default']
  // trigger error if undefined but required
  if (required && bool) throw new Error(`field ${key} is missing`)
  // coerce to type
  if (type && !bool) {
    let before = coerce(type, key, value)
    data[key] = elements
      ? (type === 'object' ? validator(before, elements) : before.map(item => validator(item, elements)))
      : before
  }
  // validate value
  if (validate) {
    const cb = check(validate, key)
    if (type === 'array') value.map(cb)
    else cb(value)
  }
  // apply default value
  if (def && bool) data[key] = def
  // apply transform
  if (transform && def == null) {
    data[key] = typeof transform === 'function'
      ? (type === 'array' ? value.map(transform) : transform(value))
      : transform
  }
}
816923
def validate(self, obj):
        """"""
        try:
            if self.resolver is not None:
                jsonschema.validate(obj, self.schema, resolver=self.resolver)
            else:
                jsonschema.validate(obj, self.schema)
        except jsonschema.ValidationError as exc:
            raise exceptions.ValidationError(str(exc))
569099
def _validate_excludes(self, excluded_fields, field, value):
        
        if isinstance(excluded_fields, Hashable):
            excluded_fields = [excluded_fields]

        # Mark the currently evaluated field as not required for now if it actually is.
        # One of the so marked will be needed to pass when required fields are checked.
        if self.schema[field].get('required', self.require_all):
            self._unrequired_by_excludes.add(field)

        for excluded_field in excluded_fields:
            if excluded_field in self.schema and self.schema[field].get(
                'required', self.require_all
            ):

                self._unrequired_by_excludes.add(excluded_field)

        if any(excluded_field in self.document for excluded_field in excluded_fields):
            exclusion_str = ', '.join(
                "'{0}'".format(field) for field in excluded_fields
            )
            self._error(field, errors.EXCLUDES_FIELD, exclusion_str)
431935
def validate(self, val):
        
        self.validate_type_only(val)
        self.validate_fields_only(val)
        return val
1000769
def validate_config_parameters(config_json, allowed_keys, allowed_types):
    """"""
    custom_fields = config_json.get(defs.PARAMETERS, [])
    for field in custom_fields:
        validate_field(field, allowed_keys, allowed_types)
        default = field.get(defs.DEFAULT)
        field_type = field.get(defs.TYPE)
        if default:
            validate_field_matches_type(field[defs.VALUE], default, field_type)
248966
def validate(self, value):
        

        query = Query(sql=value)

        passes_blacklist, failing_words = query.passes_blacklist()

        error = MSG_FAILED_BLACKLIST % ', '.join(failing_words) if not passes_blacklist else None

        if error:
            raise ValidationError(
                error,
                code="InvalidSql"
            )
4847
def validatePrivate(self, field, value) :
        """"""
        if field not in self.arangoPrivates :
            raise ValueError("%s is not a private field of collection %s" % (field, self))

        if field in self._fields :
            self._fields[field].validate(value)
        return True
738037
def _validate(self, data, owner=None):
        
        if isinstance(data, DynamicValue):
            data = data()

        if data is None and not self.nullable:
            raise ValueError('Value can not be null')

        elif data is not None:

            isdict = isinstance(data, dict)

            for name, schema in iteritems(self.getschemas()):

                if name == 'default':
                    continue

                if name in self.required:
                    if (
                        (isdict and name not in data) or
                        (not isdict and not hasattr(data, name))
                    ):
                        part1 = (
                            'Mandatory property {0} by {1} is missing in {2}.'.
                            format(name, self, data)
                        )
                        part2 = '{0} expected.'.format(schema)
                        error = '{0} {1}'.format(part1, part2)

                        raise ValueError(error)

                elif (isdict and name in data) or hasattr(data, name):

                    value = data[name] if isdict else getattr(data, name)
                    schema._validate(data=value, owner=self)
770352
def validateField(self, field) :
        """"""
        if field not in self.validators and not self.collection._validation['allow_foreign_fields'] :
            raise SchemaViolation(self.collection.__class__, field)

        if field in self.store:
            if isinstance(self.store[field], DocumentStore) :
                return self[field].validate()
            
            if field in self.patchStore :
                return self.validators[field].validate(self.patchStore[field])
            else :
                try :
                    return self.validators[field].validate(self.store[field])
                except ValidationError as e:
                    raise ValidationError( "'%s' -> %s" % ( field, str(e)) )
                except AttributeError:
                    if isinstance(self.validators[field], dict) and not isinstance(self.store[field], dict) :
                        raise ValueError("Validator expected a sub document for field '%s', got '%s' instead" % (field, self.store[field]) )
                    else :
                        raise
        return True
1140263
function validateFields ( fldsMeta, fldsValue ) {
        return reduce(function ( acc, fldMeta, fldID ) {
            var value  = getOrNull( fldsValue, fldID )
              , errors = validateField( fldID, fldMeta, value );
            return t.merge( acc, errors );
        }, {}, fldsMeta );
    }
355633
def _validate(self, data):
        """"""

        errors = {}

        # if the validator is not enabled, return the empty error dict
        if not self._enabled:
            return errors

        for field in self.validators:

            field_errors = []

            for validator in self.validators[field]:
                try:
                    validator(data.get(field, None))
                except ValidationError as e:
                    field_errors += e.messages

            # if there were errors, cast to ErrorList for output convenience
            if field_errors:
                errors[field] = ErrorList(field_errors)

        return errors
884964
def validate(self, obj):
        """"""
        if 'tags' in obj and not isinstance(obj['tags'], list):
            raise aomi_excep.Validation('tags must be a list')

        if self.present:
            check_obj(self.required_fields, self.name(), obj)
927130
def _ensure_field(self, key):
        """"""
        if self._has_field:
            self._size += 2  # comma, space
        self._has_field = True

        self._size += len(key) + 4