I'm trying to use Cerberus in Python to validate some data.
I found out that for 'boolean' type, the validator always return True, like this:
import cerberus
bool_schema = {'name': {'type': 'boolean', 'required': True}}
cerberus.schema_registry.add('bool_schema', bool_schema)
v = cerberus.Validator({'name': {'schema': 'bool_schema'}})
test1 = {'name': 'a'}
test2 = {'name': 0}
print(v.validate(test1))
print(v.validate(test2))
The above code prints two Trues.
Actually, what I need is to validate if the value is True or False (bool type in Python), other values should not pass the validator.