-
Notifications
You must be signed in to change notification settings - Fork 21
Description
This is a feature request. With the current implementation of the validation logic, the function returns an exception reporting the first validation error found. If there are multiple errors in the data instance, the only way to find out is to correct them one by one and run the validation method again each time. It would be nice to have a validation option they could perform a full validation which would return a list of all validation errors found in the instance.
Since the current method returns None or a single exception, maybe the best way would be to have a new method validate_all(), which would return a tuple (result, errors[]) where result would be 0 for a successful validation and non-zero otherwise, and the error list would be empty in case of result=0, and populated with a list of validation errors otherwise.
I think this could be useful in cases where yangson is being used to validate data instances, for custom service data models, where the error messages are also customized for yang leaves that must follow certain patterns.