Description
cyclonedx.validation.SchemabasedValidator defines only a single method available: .validate_str()
, which returns only the first problem found.
I would like to ask for an extension of the interface with a new method iterate_errors()
to iterate over all the problems.
This could be used to add some smartness finding the most helpful error[s] - something like best_match
in https://github.com/python-jsonschema/jsonschema/blob/main/jsonschema/exceptions.py do.
The underlying libraries already have support for it:
jsonschema
has Validator.iter_errors()
:
https://github.com/python-jsonschema/jsonschema/blob/f5cfc0ead76a8fc69db040cd94ed3a5e505dca81/jsonschema/protocols.py#L169-L172
Have not looked deeper into the XML case, but it is probably also available, as only the last error is returned (L71):
cyclonedx-python-lib/cyclonedx/validation/xml.py
Lines 62 to 72 in 1a932a2