问题 Is there a way to have Cerberus validate that two fields have the same amount of elements? For instance, this document would validate: {'a': [1, 2, 3], b: [4, 5, 6]} And this won't: {'a': [1, 2, 3], 'b': [7, 8]} So far I have come up with this schema: {'a': {'required':False, 'type'= 'list', 'dependencies':'b'}, 'b': {'required':False, 'type'= 'list', 'dependencies':'a'}} But there's no rule to test the equal length of two fields. 回答1: With a custom rule it is pretty straight-forward: >>>