pip install cerberus
python
from cerberus import Validator
schema = {
'name': {'type': 'string', 'required': True},
'age': {'type': 'integer', 'required': True, 'min': 18, 'max': 30},
'score': {'type': 'float', 'required': True, 'min': 0, 'max': 100}
}
validator = Validator(schema)
student_data = {
'name': 'Alice',
'age': 22,
'score': 85.5
}
is_valid = validator.validate(student_data)
if is_valid:
else:
print(validator.errors)