You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To do this ErrorIterator needs a Display impl, which could require making it a wrapper over Box<dyn Iterator<Item = ValidationError<'a>> + Sync + Send + 'a>, rather than just a type alias (a mild breaking change).
This will allow throwing this error to dyn Error or anyhow without any manual mapping. This impl should probably just print a list of all errors, like the examples show. Roughly:
First of all, thank you for opening this issue, it has been unaddressed way too long.
My inclination is to adjust the API so this type is only returned by a new iter_errors function, and validate will return just the first error. I believe it will make the API more consistent with other libraries in the JSON Schema ecosystem (e.g. Python's jsonschema has it + Python bindings to this crate already have it). Even though it is a significant breaking change, I think it should be addressed before 1.0.
Other than that, I completely agree with the proposed changes and will address it in the next couple of releases.
To do this
ErrorIterator
needs aDisplay
impl, which could require making it a wrapper overBox<dyn Iterator<Item = ValidationError<'a>> + Sync + Send + 'a>
, rather than just a type alias (a mild breaking change).This will allow throwing this error to
dyn Error
oranyhow
without any manual mapping. This impl should probably just print a list of all errors, like the examples show. Roughly:The text was updated successfully, but these errors were encountered: