def validate_default_is_of_one_of_declared_types(default, type_, **kwargs): if isinstance(type_, six.string_types): type_ = [type_] if not is_value_of_any_type(default, type_): raise ValidationError( MESSAGES['default']['invalid_type'].format(default, type_), )
def validate_type(value, types, **kwargs): """ Validate that the value is one of the provided primative types. """ if not is_value_of_any_type(value, types): raise ValidationError(MESSAGES['type']['invalid'].format( repr(value), get_type_for_value(value), types, ))
def validate_type(value, types, **kwargs): """ Validate that the value is one of the provided primative types. """ if not is_value_of_any_type(value, types): raise ValidationError(MESSAGES['type']['invalid'].format( repr(value), get_type_for_value(value), types, ))
def validate_default_is_of_one_of_declared_types(default, type_, **kwargs): if isinstance(type_, six.string_types): type_ = [type_] if not is_value_of_any_type(default, type_): raise ValidationError( MESSAGES['default']['invalid_type'].format(default, type_), )
def inner(value, *args, **kwargs): """ Format validation should only be executed if the value is of one of the appropriate types for the format. http://json-schema.org/latest/json-schema-validation.html#anchor105 """ if is_value_of_any_type(value, types): return func(value, *args, **kwargs)
def inner(value, *args, **kwargs): """ Format validation should only be executed if the value is of one of the appropriate types for the format. http://json-schema.org/latest/json-schema-validation.html#anchor105 """ if is_value_of_any_type(value, types): return func(value, *args, **kwargs)
def inner(value, *args, **kwargs): if value is EMPTY or is_value_of_any_type(value, types): return func(value, *args, **kwargs)
def from_native(self, data, files=None): if not is_value_of_any_type(data, (ARRAY, OBJECT, STRING)): raise serializers.ValidationError( self.error_messages['invalid_type_for_items'] ) return super(BaseItemsSerializer, self).from_native(data, files)
def inner(value, *args, **kwargs): if value is EMPTY or is_value_of_any_type(value, types): return func(value, *args, **kwargs)