Is there any way to define conditional rules using voluptuous?
Here's the schema I have:
from voluptuous import Schema, All, Any
schema = Schema({
'resolution': All(str, Any('1920x1080', '1280x720')),
'bitrate': 20,
})
That's ok, but now I want to validate bitrate value based on resolution value. If I have 1920x1080
as resolution, than I need to be shure that bitrate is one of these values: 20, 16, 12, 8; and when it's 1280x720
then bitrate should be one of these: 10, 8, 6, 4.
How can I do that? There's info on the project's github page but I can't find my case there.