-
Notifications
You must be signed in to change notification settings - Fork 128
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
export and validate: Substantially improve validation errors #1134
Conversation
Codecov ReportBase: 68.08% // Head: 68.14% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1134 +/- ##
==========================================
+ Coverage 68.08% 68.14% +0.06%
==========================================
Files 62 62
Lines 6690 6725 +35
Branches 1641 1646 +5
==========================================
+ Hits 4555 4583 +28
- Misses 1829 1836 +7
Partials 306 306
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
thanks, @trs! this is much more helpful:
|
Thanks so much for taking this up Tom! I can remember a time when our validation errors were helpful (this is a long time ago), so it's great to get them back to something that one can actually interpret! 🙌 |
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.
Thanks for fixing up all the things I missed when I copied over the json module 🙏
59b5505
to
750db2b
Compare
• Names the specific utility functions • Uses the full commit SHA instead of abbreviating • Uses an absolute repo URL instead of a relative one • Notes the licensing of subsequent modifications • Uses rST syntax to demarcate the included ID3C license
It refers to shorten(), which we didn't copy over from ID3C. This docstring is based on the shorten() docstring from ID3C (at the same commit as the rest of the file when we copied it into Augur).
Noticed it was missing.
Doctests must be in their own block. rST was interpreting these as badly-formed blockquotes.
All errors are reported in the case of subschemas inside a "oneOf" validator, such as used by our "tree" property. Previously only the top-level error was reported and it was worse than useless as it was incredibly long and contained no actionable information. Suberrors are grouped by the validator arm they failed, making it clear why each element of a "oneOf" failed. Errors avoid being overly long by consistently shortening output that might be long. Different shortening strategies are used for different values in an attempt to preserve the most useful information. Paths in error messages now index into the given JSON being validated, not the JSON Schema. This disconnect was confusing as the schema path refers to properties that don't exist in the JSON being validated. Resolves <#1044>.
a8ea3dd
to
0f4b655
Compare
All errors are reported in the case of subschemas inside a "oneOf" validator, such as used by our "tree" property. Previously only the top-level error was reported and it was worse than useless as it was incredibly long and contained no actionable .
Suberrors are grouped by the validator arm they failed, making it clear why each element of a "oneOf" failed.
Errors avoid being overly long by consistently shortening output that might be long. Different shortening strategies are used for different values in an attempt to preserve the most useful information.
Paths in error messages now index into the given JSON being validated, not the JSON Schema. This disconnect was confusing as the schema path refers to properties that don't exist in the JSON being validated.
Resolves #1044.
Testing
Checklist