I know that according to the Cerberus documentation, it is possible to define validation dependencies, according to other keys values, such as:
schema = {'field1': {'required': False},
'field2': {'required': True,
'dependencies': {'field1': ['one', 'two']}}}
Where field2
is valid only if field1
exists and has value one
or two
.
I would like to know if there's a way of having a validation rule that is considered depending on the value of the key itself.
Something like: field2
needs field1
value False
only if field2
value is True
, and vice-versa.
Only one of the fields must be allowed to be True
at a time.