-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validator #683
Add validator #683
Conversation
It's still a WIP, it's missing some things: * More tests * Check if tests cover all the branching * Review error messages * Better type intersection * Even more tests, but done with quickcheck or similar
The test in question was a subset of another test
let cbor = Cow::Owned(cbor); | ||
if let Some(value) = value.get(&cbor) { | ||
if let e @ Err(_) = validate(&value.decode(), ty) { | ||
return e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I just realise:
- if these errors are to be read by humans, they would be vastly more useful if they carried the context (i.e. the path inside the event payload object)
- since these errors will usually not be read by humans and they are expensive to construct (string formatting), it would be really great if the error carried the information for printing but only did it in its
Display
impl
These two should probably be done in separate add-on PRs once this is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, nearly there, just a few test upgrades in case someone ever breaks a test.
No description provided.