-
Notifications
You must be signed in to change notification settings - Fork 11
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
Better exception classes #89
Conversation
There are now two different exceptions, `JsonschemaValidationError` and `PydanticValidationError`, to better communicate the difference between the two validation modes. This makes it much easier to consume errors, since the two validators produce errors in vastly different shapes.
I don't see a purpose to wrapping the exception in a list, and it makes consuming the error more difficult.
Codecov Report
@@ Coverage Diff @@
## master #89 +/- ##
==========================================
+ Coverage 89.47% 94.96% +5.48%
==========================================
Files 14 16 +2
Lines 1378 1490 +112
==========================================
+ Hits 1233 1415 +182
+ Misses 145 75 -70
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
approve in general, thank you! might be worth tuning up test just a bit
@@ -113,9 +113,9 @@ def _validate_obj_json(data, schema, missing_ok=False): | |||
for error in sorted(validator.iter_errors(data), key=str): | |||
if missing_ok and "is a required property" in error.message: | |||
continue | |||
error_list.append([error]) | |||
error_list.append(error) |
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.
yikes, thank you @dchiquito
thank you @dchiquito , looks kosher to me, so let's proceed... and let's release right away |
I had some difficulty parsing the exceptions being thrown now that I need to differentiate between pydantic and jsonschema validation errors. This PR should mitigate that pain a bit.
Not a blocker, but nice to have in the future.