13
I have tried
voluptuous and schema, both of which are simple and great in validation, but they both do exception-based error reporting, i.e. they fail on first error. Is there a way I can get all validation errors of data in Voluptuous or Schema?
I found jsonschema that seems matching some of the requirements, but does not have validation for object keys, and custom function based validation (e.g. lambdas).
Requirement:
def myMethod(input_dict):
#input_dict should abide to this schema ->
# { 'id' : INT , 'name':'string 5-10 chars','hobbies': LIST OF STRINGS }
# for incorrect input like
# {'id': 'hello','name':'Dhruv','hobbies':[1,2,3] }
# I should be able to return all errors like
# ['id' is not integer,'hobbies' is not list of strings ]