Validation function for `value` and `defaultValue`.
172394
function checkSelectPropTypes(props) {
  ReactControlledValuePropTypes_1.checkPropTypes('select', props, getCurrentFiberStackAddendum$3);

  for (var i = 0; i < valuePropNames.length; i++) {
    var propName = valuePropNames[i];
    if (props[propName] == null) {
      continue;
    }
    var isArray = Array.isArray(props[propName]);
    if (props.multiple && !isArray) {
      warning$11(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
    } else if (!props.multiple && isArray) {
      warning$11(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
    }
  }
}
390244
def validate_wrap(self, value):
        '''  '''
        self.item_type.validate_wrap(value)

        if value not in self.values:
            self._fail_validation(value, 'Value was not in the enum values')
837395
def validate(self, value):
        
        errors = []
        value = self._validate_type(value, errors)
        self._validate_value(value, errors)

        if errors:
            raise ValidationErrors(errors)

        return value
165444
def validate(self, value):
        """"""
        if value is not None and not isinstance(value, str):
            raise ValidationError("field must be a string")

        super().validate(value)
983655
@Override
    public void validateDefault(InputProblemReporter rep, boolean normalize)
        throws XMLStreamException
    {
        // First, basic checks that it's a valid non-empty name:
        String def = validateDefaultName(rep, normalize);

        // And then that it's one of listed values:
        String shared = mEnumValues.find(def);
        if (shared == null) {
            reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
                                    +mEnumValues+")");
        }

        // Ok, cool it's ok...
        if (normalize) {
            mDefValue.setValue(shared);
        }
    }
1065987
def validate_values(func, dic):
    
    for value_name, value in dic.items():
        if not func(value):
            raise ValueError('{} can not be {}'.format(value_name, value))
1029397
def _validate_collections_have_default_values(class_name, property_name, property_descriptor):
    """"""
    # We don't want properties of collection type having "null" values, since that may cause
    # unexpected errors during GraphQL query execution and other operations.
    if property_descriptor.type_id in COLLECTION_PROPERTY_TYPES:
        if property_descriptor.default is None:
            raise IllegalSchemaStateError(u'Class "{}" has a property "{}" of collection type with '
                                          u'no default value.'.format(class_name, property_name))
936867
def validate(self):
        
        for name, col in self._columns.items():
            v = getattr(self, name)
            if v is None and not self._values[name].explicit and col.has_default:
                v = col.get_default()
            val = col.validate(v)
            self._set_column_value(name, val)
1250610
def validate(self, value):
        
        if not self._compiled_regex.match(value):
            raise ValidationError(
                'value {:s} not match r"{:s}"'.format(value, self._regex))
934128
function validate ( inputOptions ) {

		var i, optionName, optionValue,
			filteredOptions = {};

		for ( i = 0; i < FormatOptions.length; i+=1 ) {

			optionName = FormatOptions[i];
			optionValue = inputOptions[optionName];

			if ( optionValue === undefined ) {

				// Only default if negativeBefore isn't set.
				if ( optionName === 'negative' && !filteredOptions.negativeBefore ) {
					filteredOptions[optionName] = '-';
				// Don't set a default for mark when 'thousand' is set.
				} else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) {
					filteredOptions[optionName] = '.';
				} else {
					filteredOptions[optionName] = false;
				}

			// Floating points in JS are stable up to 7 decimals.
			} else if ( optionName === 'decimals' ) {
				if ( optionValue >= 0 && optionValue < 8 ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// These options, when provided, must be functions.
			} else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) {
				if ( typeof optionValue === 'function' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// Other options are strings.
			} else {

				if ( typeof optionValue === 'string' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}
			}
		}

		// Some values can't be extracted from a
		// string if certain combinations are present.
		throwEqualError(filteredOptions, 'mark', 'thousand');
		throwEqualError(filteredOptions, 'prefix', 'negative');
		throwEqualError(filteredOptions, 'prefix', 'negativeBefore');

		return filteredOptions;
	}
961546
def validate(self, value):
        
        try:
            # trap blank fields here
            if not self.blank or value:
                v = int(value)
                if v < 0:
                    return None
            return value
        except ValueError:
            return None
571701
function (name, value, schema, options, callback) {

    var err
        , nullable = false
        , valCount = 0;

    // Set default values
    if (options && options.partial !== true) {
        if (schema.hasOwnProperty('default') && value === undefined) {
            if ((_.isString(schema.default) || _.isBoolean(schema.default) || _.isNumber(schema.default)) || (schema.hasOwnProperty('nullable') && schema.nullable === true && _.isNull(schema.default))) {
                value = schema.default;
            }
            else {
                if (_.isFunction(schema.default)) {
                    value = (schema.default)();
                }
                else {
                    err = _.assign({
                        code: 'UnexpectedDefaultValue',
                        'id': name,
                        msg: name + ' default value is faulty. ' + typeof(schema.default) + ' given but not expected'
                    }, err);
                }
            }
        }
    }
    if (value !== undefined) {

        // Check if null value set and is allowed
        if ((schema.hasOwnProperty('nullable') && schema.nullable === true) && value == null) {
            value = null;
        }
        else {
            //Check type
            if (schema.hasOwnProperty('type')) {
                var type = schema.type;
                if (_.isFunction(type) && type.name.toLowerCase()) {
                    type = type.name.toLowerCase();
                }
                var validValue = validationRule.checkType(type, value);
                if (validValue === undefined) {
                    err = _.assign({
                        code: 'UnexpectedType',
                        'id': name,
                        msg: name + ' is unexpected type. ' + typeof(value) + ' given ' + type.toLowerCase() + ' expected'
                    }, err);
                }
                else {
                    value = validValue;
                }
            }

            //Validate single value
            if ((_.isString(value) || _.isBoolean(value) || _.isNumber(value))) {

                //Check minLength
                if (schema.hasOwnProperty('minLength')) {
                    if (validationRule.minLength(schema.minLength, value) == false) {
                        err = _.assign({
                            code: 'MinLengthUnderachieved',
                            'id': name,
                            msg: name + ' length is less than ' + schema.minLength + ' chars'
                        }, err);
                    }
                }

                //Check maxLength
                if (schema.hasOwnProperty('maxLength')) {
                    if (validationRule.maxLength(schema.maxLength, value) == false) {
                        err = _.assign({
                            code: 'MaxLengthExceeded',
                            'id': name,
                            msg: name + ' length is more than ' + schema.maxLength + ' chars'
                        }, err);
                    }
                }


                //Check min
                if (schema.hasOwnProperty('min')) {
                    if (typeof(value) == 'number') {
                        if (validationRule.min(schema.min, value) == false) {
                            err = _.assign({
                                code: 'MinValueUnderachived',
                                'id': name,
                                msg: name + ' value is less than ' + schema.min
                            }, err);
                        }
                    }
                }

                //Check max
                if (schema.hasOwnProperty('max')) {
                    if (typeof(value) == 'number') {
                        if (validationRule.max(schema.max, value) == false) {
                            err = _.assign({
                                code: 'MaxValueExceeded',
                                'id': name,
                                msg: name + ' value is more than ' + schema.max
                            }, err);
                        }
                    }
                }

                //Check allow
                if (schema.hasOwnProperty('allow')) {
                    if (typeof(value) == 'number' || typeof(value) == 'string') {
                        if (validationRule.allow(schema.allow, value) == false) {
                            err = _.assign({
                                code: 'ValueNotAllowed',
                                'id': name,
                                msg: name + ' value \'' + value + '\' is not allowed. Use one of the following values: ' + (schema.allow).join(",")
                            }, err);
                        }
                    }
                }

                //Check deny
                if (schema.hasOwnProperty('deny')) {
                    if (typeof(value) == 'number' || typeof(value) == 'string') {
                        if (validationRule.deny(schema.deny, value) == false) {
                            err = _.assign({
                                code: 'ValueNotAllowed',
                                'id': name,
                                msg: name + ' value \'' + value + '\' is not allowed. Do not use one of the following values: ' + (schema.deny).join(",")
                            });
                        }
                    }
                }

                //Check match
                if (schema.hasOwnProperty('match')) {
                    if (validationRule.match(schema.match, value) == false) {
                        err = _.assign({
                            code: 'PatternMismatch',
                            'id': name,
                            msg: name + ' does not match pattern ' + schema.match + ''
                        }, err);
                    }
                }


                // Convert values
                value = convert.convertValue(schema, value);
            }
        }

        //Validate Array
        if (_.isArray(value)) {
            for (var thisVal in value) {
                valCount++;
                // Check if null value set and is allowed
                if ((schema.hasOwnProperty('nullable') && schema.nullable === true) && value == null) {
                    value = null;
                }
                else {
                    //Check type
                    if (schema.hasOwnProperty('subType')) {
                        if (_.isFunction(schema.subType) && (schema.subType.name).toLowerCase()) {
                            schema.subType = (schema.subType.name).toLowerCase();
                        }
                        var validSubValue = validationRule.checkType(schema.subType, value[thisVal]);
                        if (validSubValue === undefined) {
                            err = _.assign({
                                code: 'UnexpectedType',
                                'id': name,
                                msg: name + '[' + valCount + ']' + ' is unexpected type. ' + typeof(value[thisVal]) + ' given ' + (schema.subType).toLowerCase() + ' expected'
                            }, err);
                        }
                        else {
                            value[thisVal] = validSubValue;
                        }
                    }

                    //Check minLength
                    if (schema.hasOwnProperty('minLength')) {
                        if (validationRule.minLength(schema.minLength, value[thisVal]) == false) {
                            err = _.assign({
                                code: 'MinLengthUnderachieved',
                                'id': name,
                                msg: name + '[' + valCount + ']' + ' length is less than ' + schema.minLength + ' chars'
                            }, err);
                        }
                    }

                    //Check maxLength
                    if (schema.hasOwnProperty('maxLength')) {
                        if (validationRule.maxLength(schema.maxLength, value[thisVal]) == false) {
                            err = _.assign({
                                code: 'MaxLengthExceeded',
                                'id': name,
                                msg: name + '[' + valCount + ']' + ' length is more than ' + schema.maxLength + ' chars'
                            }, err);
                        }
                    }


                    //Check min
                    if (schema.hasOwnProperty('min')) {
                        if (typeof(value) == 'number') {
                            if (validationRule.min(schema.min, value[thisVal]) == false) {
                                err = _.assign({
                                    code: 'MinValueUnderachived',
                                    'id': name,
                                    msg: name + '[' + valCount + ']' + ' value is less than ' + schema.min
                                }, err);
                            }
                        }
                    }

                    //Check max
                    if (schema.hasOwnProperty('max')) {
                        if (typeof(value) == 'number') {
                            if (validationRule.max(schema.max, value[thisVal]) == false) {
                                err = _.assign({
                                    code: 'MaxValueExceeded',
                                    'id': name,
                                    msg: name + '[' + valCount + ']' + ' value is more than ' + schema.max
                                }, err);
                            }
                        }
                    }

                    //Check allow
                    if (schema.hasOwnProperty('allow')) {
                        if (typeof(value) == 'number' || typeof(value[thisVal]) == 'string') {
                            if (validationRule.allow(schema.allow, value[thisVal]) == false) {
                                err = _.assign({
                                    code: 'ValueNotAllowed',
                                    'id': name,
                                    msg: name + '[' + valCount + ']' + ' value \'' + value[thisVal] + '\' is not allowed. Use one of the following values: ' + (schema.allow).join(",")
                                }, err);
                            }
                        }
                    }

                    //Check deny
                    if (schema.hasOwnProperty('deny')) {
                        if (typeof(value) == 'number' || typeof(value[thisVal]) == 'string') {
                            if (validationRule.deny(schema.deny, value[thisVal]) == false) {
                                err = _.assign({
                                    code: 'ValueNotAllowed',
                                    'id': name,
                                    msg: name + '[' + valCount + ']' + ' value \'' + value[thisVal] + '\' is not allowed. Do not use one of the following values: ' + (schema.deny).join(",")
                                });
                            }
                        }
                    }

                    //Check match
                    if (schema.hasOwnProperty('match')) {
                        if (validationRule.match(schema.match, value[thisVal]) == false) {
                            err = _.assign({
                                code: 'PatternMismatch',
                                'id': name,
                                msg: name + '[' + valCount + ']' + ' does not match pattern ' + schema.match + ''
                            }, err);
                        }
                    }
                    // Convert values
                    value[thisVal] = convert.convertValue(schema, value[thisVal]);
                }
            }
        }
    }


    //Check required
    if (schema.hasOwnProperty('required')) {
        if (options && options.partial !== true) {
            if (schema.required == true && (value == undefined || value == "")) {
                if ((schema.hasOwnProperty('public') && schema.public.hasOwnProperty('set') && schema.public.set == false) || (schema.hasOwnProperty('nullable') && schema.nullable === true && _.isNull(value))) {

                }
                else {
                    err = _.assign({
                        code: 'MissingRequiredParameter',
                        id: name,
                        msg: name + ' is required but invalid value or no value given'
                    }, err);
                }
            }
        }
    }

    //Check public
    if (schema.hasOwnProperty('public')) {
        if (schema.public == false || ((schema.public.hasOwnProperty('get') && schema.public.get != true))) {
            value = undefined;
        }
    }
    callback(err, value);
}
1309397
def validate_value(self, value):
        """"""
        super(ValuesListField, self).validate_value(value)

        if value is not None:
            if value not in self.selection_to_id_map:
                raise ValidationError(
                    self.record,
                    'Field "{}" invalid value "{}". Valid options: {}'.format(
                        self.name,
                        value,
                        ', '.join(self.selection_to_id_map.keys())
                    )
                )
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;
}
813808
def ensure_valid_default_value(value)
      return unless !value.nil? && types && types.none? { |type| type === value }
      raise TypeError
    end
913527
def _validate(self,val):
        """"""
        if isinstance(self.class_, tuple):
            class_name = ('(%s)' % ', '.join(cl.__name__ for cl in self.class_))
        else:
            class_name = self.class_.__name__
        if self.is_instance:
            if not (isinstance(val,self.class_)) and not (val is None and self.allow_None):
                raise ValueError(
                    "Parameter '%s' value must be an instance of %s, not '%s'" %
                    (self.name, class_name, val))
        else:
            if not (val is None and self.allow_None) and not (issubclass(val,self.class_)):
                raise ValueError(
                    "Parameter '%s' must be a subclass of %s, not '%s'" %
                    (val.__name__, class_name, val.__class__.__name__))
885126
def validate_prop(value):
    """"""
    if (
            isinstance(value, CLASS_TYPES) and
            issubclass(value, HasProperties)
    ):
        value = Instance('', value)
    if not isinstance(value, basic.Property):
        raise TypeError('Contained prop must be a Property instance or '
                        'HasProperties class')
    if value.default is not utils.undefined:
        warn('Contained prop default ignored: {}'.format(value.default),
             RuntimeWarning)
    return value