I'm validating documents with Cerberus that roughly look like this:
{"a_dict": {"field1": "test1",
"field2": "test2",
"field3": "test3"}}
Not all of the fields in the subdocument need to be present, but one should. So far my schema looks like this:
"a_dict": {"type": "dict",
"schema": {"field1": {"type": "string",
"required": False},
"field2": {"type": "string",
"required": False},
"field3": {"type": "string",
"required": False}}}
How can I enforce that at least one of the fieldX
is provided?
This question is derived fom this issue.