from cerberus import Validator
validator = Validator()
schema = {
'name': {'type': 'string', 'required': True},
'age': {'type': 'integer', 'min': 18, 'max': 65},
'email': {'type': 'string', 'regex': '[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+'}
}
data = {
'name': 'John Doe',
'age': 25,
'email': 'johndoe@example.com'
}
is_valid = validator.validate(data, schema)
if is_valid:
else: