Default validation for all types
355809
def validate_type(prop, value, expected):
    

    # Validate on expected type(s), but ignore None: defaults handled elsewhere
    if value is not None and not isinstance(value, expected):
        _validation_error(prop, type(value).__name__, None, expected)
642469
function validatePropTypes(element) {
  var componentClass = element.type;
  if (typeof componentClass !== 'function') {
    return;
  }
  var name = componentClass.displayName || componentClass.name;
  var propTypes = componentClass.propTypes;
  if (propTypes) {
    currentlyValidatingElement = element;
    checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
    currentlyValidatingElement = null;
  } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
    propTypesMisspellWarningShown = true;
    warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
  }
  if (typeof componentClass.getDefaultProps === 'function') {
    warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
  }
}
1126645
def validate_type(self, type_):
        
        if type_ is not None and type_ not in self.types_set:
            raise ValueError('Invalid type for %s:%s' % (self.__class__, type_))
346181
function validateCompoundWithType(attribute, values) {
		            for(var i in values) {
		                var value = values[i];
		                if(typeof(value) !== 'object') {
			                  errors.push([attribute + '-' + i, "not-an-object"]);
		                } else if(! value.type) {
			                  errors.push([attribute + '-' + i, "missing-type"]);
		                } else if(! value.value) { // empty values are not allowed.
			                  errors.push([attribute + '-' + i, "missing-value"]);
		                }
		            }
	          }
1189733
def _validate_all(data, schema):
    
    vldtr = jsonschema.Draft4Validator(schema)  # :raises: SchemaError, ...
    errors = list(vldtr.iter_errors(data))

    return (not errors, [err.message for err in errors])
1000430
function checkType(type,value){
             if(type){
                 if(typeof type == 'string' && type != 'any' &&
                         (type == 'null' ? value !== null : typeof value != type) &&
                         !(value instanceof Array && type == 'array') &&
                         !(value instanceof Date && type == 'date') &&
                         !(type == 'integer' && value%1===0)){
                     return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
                 }
                 if(type instanceof Array){
                     var unionErrors=[];
                     for(var j = 0; j < type.length; j++){ // a union type
                         if(!(unionErrors=checkType(type[j],value)).length){
                             break;
                         }
                     }
                     if(unionErrors.length){
                         return unionErrors;
                     }
                 }else if(typeof type == 'object'){
                     var priorErrors = errors;
                     errors = [];
                     checkProp(value,type,path);
                     var theseErrors = errors;
                     errors = priorErrors;
                     return theseErrors;
                 }
             }
             return [];
         }
218522
function validate(message, type) {
  assert(
    typeOf(message) === 'object',
    'You must pass a message object.',
  );

  rules.forEach((rule) => {
    if (message[rule.name]) {
      const types = [].concat(rule.types);

      assert(
        types.some(t => typeOf(message[rule.name]) === t),
        `"${rule.name}" must be ${types.join(' or ')}.`,
      );
    }
  });

  if (asserts[type]) {
    asserts[type](message);
  } else {
    throw new TypeError('Invalid event type');
  }
}
475331
def check_types(value)
      if types&.none? { |type| type === value }
        Lita.logger.fatal(
          I18n.t("lita.config.type_error", attribute: name, types: types.join(", "))
        )

        raise ValidationError
      end
    end
707370
function Types() {
 
  var self = this
    , types = {};

  this.register = function (typeInfo) {

    if (!typeInfo) { throw new Error("Type information is required"); }

    var type = typeInfo.type;

    if (!typeInfo.name) {
      throw new Error("Type name is missing");
    }
    if (!typeInfo.version) {
      throw new Error("Type version is missing");
    }

    typeInfo.create = typeInfo.create || function create(values) {
      var instance = {
        "type": typeInfo.name,
        "version": typeInfo.version
      };

      if (type) {
        Object.keys(type).forEach(function (name) {
          instance[name] = type[name];
        });
      }
      if (values) {
        Object.keys(values).forEach(function (name) {
          instance[name] = values[name];
        });
      }

      return instance;
    };

    typeInfo.validate = (function (validation) {
      return function validate(instance) {
        var results = [];
        if (!instance) {
          results.push("Instance of type '" + typeInfo.name + "' can not be null or undefined");
        } else {
          if (!instance.type) {
            results.push("Instance of type '" + typeInfo.name + "' must have a type property");
          } else if (instance.type !== typeInfo.name) {
            results.push("Instance is of type '" + instance.type + "' and not of '" + typeInfo.name + "'");
          }
          if (!instance.version) {
            results.push("Instance of type '" + typeInfo.name + "' does not have a version");
          } else if (instance.version !== typeInfo.version) {
            results.push("Instance is version '" + instance.type + "' and not version '" + typeInfo.name + "'");
          }
          if (validation) {
            results = results.concat(validation(instance));
          }
        }
        return results;
      };
    }(typeInfo.validate));

    if (types[typeInfo.name] && types[typeInfo.name][typeInfo.version]) {
      throw new Error("Type '" + typeInfo.name + "' with version '" +
        typeInfo.version + "' is already registered.");
    }

    types[typeInfo.name] = types[typeInfo.name] || {};
    types[typeInfo.name][typeInfo.version] = typeInfo;

    if (typeInfo.version > (types[typeInfo.name].latestVersion || -1)) {
      types[typeInfo.name].latestVersion = typeInfo.version;
    }
  };

  this.validate = function (item) {
    return item && item.type && item.version &&
      types[item.type] && types[item.type][item.version]
      && types[item.type][item.version].validate(item);
  };

  this.get = function (name, version) {

    if (typeof name !== 'string' && typeof version !== 'number') {
      if (typeof name === 'object' && name.name && name.version) {
        version = name.version;
        name = name.name;
      } else if (typeof name === 'object' && name.type && name.version) {
        version = name.version;
        name = name.type;
      }
    }

    if (!types[name]) {
      throw new Error("Type '" + name + "' is not registered.");
    }
    version = version || types[name].latestVersion;
    if (!types[name][version]) {
      throw new Error("Type '" + name + "' with version '" +
        version + "' is not registered.");
    }
    return types[name][version];
  };

  this.getAll = function () {
    return Object.keys(types).map(function (name) {
      return types[name];
    });
  };

  this.create = function (name, version, values) {

    if (typeof name === 'string' && typeof version === 'object' && !values) {
      values = version;
      version = undefined;
    } else if (typeof name !== 'string' && typeof version !== 'number') {
      if (typeof name === 'object' && (name.type || name.name) && name.version) {
        values = name;
        version = name.version;
        name = name.type || name.name;
      }
    }

    return self.get(name, version).create(values);
  };
}
294348
def validate_type(value, types, **kwargs):
    
    if not is_value_of_any_type(value, types):
        raise ValidationError(MESSAGES['type']['invalid'].format(
            repr(value), get_type_for_value(value), types,
        ))
1317691
def _validate_type(self):  # type: () -> None
        """"""
        if not isinstance(self._value, self._type):
            title = '{} has an invalid type'.format(self._key_name())
            description = '{} must be a {}'.format(self._key_name(), self._type.__name__)

            self._add_error(title=title, description=description)
536368
def type(self, value):
        
        if value == self._defaults['type'] and 'type' in self._values:
            del self._values['type']
        else:
            self._values['type'] = value
234772
def validate(self, value):
        """"""
        value = self.pre_validate(value)
        if not self._typecheck(value):
            raise ValueError('%r failed type check' % value)
        return value
297685
public boolean validateImportType(ImportType importType, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(importType, diagnostics, context);
	}
330174
function validate (type, value) {
  const { t } = readType(type)
  if (value === undefined || value === null) return { require: true }

  switch (t) {
    case SOPHIA_TYPES.int:
      return isNaN(value) || ['boolean'].includes(typeof value)
    case SOPHIA_TYPES.bool:
      return typeof value !== 'boolean'
    case SOPHIA_TYPES.address:
      return !(value[2] === '_' && ['ak', 'ct'].includes(value.slice(0, 2)))
    default:
      return false
  }
}
1120108
function fixDefaultChecked( elem ) {
	if ( rcheckableType.test( elem.type ) ) {
		elem.defaultChecked = elem.checked;
	}
}
347445
def validate_wrap(self, value, *types):
        '''  '''
        for type in types:
            if isinstance(value, type):
                break
        else:
            self._fail_validation_type(value, *types)

        if self.min is not None and value < self.min:
            self._fail_validation(value, 'Value too small')
        if self.max is not None and value > self.max:
            self._fail_validation(value, 'Value too large')