Consider the following Cerberus schema:
{
'employee': {
'type': 'list',
'schema': {
'type': 'dict',
'schema': {
'id': {'required': True, 'type': 'integer'},
'name': {'required': True, 'type': 'string'}
}
}
},
'ceo-employee-id': {'required': True, 'type': 'integer'}
}
1) How can I validate that the ceo-employee-id matches one of the id values in the employee list? (Referential integrity)
2) How can I validate that each id in the employee list is unique (i.e. no duplicate employee ids)?
I realize I can do this at run-time after validating and parsing the config as suggested by @rafael below. I am wondering if I can do it with the Cerberus validation features.