Started to use cerberus for contract testing purposes.
It works perfectly in cases, when we got dict-based JSON structure, e.g:
{'results': [{"key": "value"}, {"key": "value"}, {"key":"value}]}
But everything goes bad when response is just a list of dicts, e.g.:
[{"key": "value"}, {"key": "value"}, {"key":"value}]
The basic error im facing with is:
cerberus.validator.DocumentError: '[{'id': 'XXX', 'is_supported': True}]' is not a document, must be a dict
Specifying top level type: "list" in schema not helped, returning schema error:
cerberus.schema.SchemaError: {'type': ['must be of dict type']}
The naive solution is just to pass through list and validate all the entities inside. But looks like there should be more proper way to do this.
As far as i understand (and as google says), top level array is a valid JSON structure, so there should be a way to validate it properly, isn't it?