I have a set of schemas I'm using to validate one of my input routes:
# schemas is just a dict of validator schemas
REGISTRATION_VALIDATOR = {
'email_address': schemas['email_address'],
'user_level': schemas['user_level'],
'first_name': schemas['first_name'],
'last_name': schemas['last_name'],
'mobile_number': schemas['mobile_number'],
'auth_method': schemas['auth_method']
}
but I need to define that either email_address
or mobile_number
is required but not both. How to require only one of those two keys?
There's the
excludes
rule that you can set for both fields, pointing with the constraint to the other.