-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use discriminated unions to provide more helpful error messages #245
Conversation
This allows Pydantic to generate more useful validation errors.
Some test data was missing the `schemaKey` attribute for `contributor`.
0ce951c
to
f248164
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #245 +/- ##
===========================================
+ Coverage 87.42% 97.74% +10.31%
===========================================
Files 16 16
Lines 1726 1727 +1
===========================================
+ Hits 1509 1688 +179
+ Misses 217 39 -178
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
17cea29
to
3480631
Compare
There's some test failures happening here that I have to look into, marking this as draft for now. |
3480631
to
b90238f
Compare
b90238f
to
a23a0a9
Compare
The changes look good to me. The JSON schemas have changed though mostly because of the inclusion of the discriminator object as mentioned in the discriminated union docs. We may need to increase the JSON schema version, but I don't expect much perceivable difference for the end users. @yarikoptic @satra Should me up the JSON schema version for this one? We didn't up the JSON schema version for #236, so the changes in JSON schemas from that PR are yet to be included in the latest published schemas. |
my personal take is that for any change upon release we should up the json version, otherwise it all becomes ambiguous and possibly hard to troubleshoot later on. "explicit better than implicit"! |
Is there something I need to add to the PR to bump the schema version? |
just added labels so we can release with this. see the consts.py file. that's where the schema version will need to be incremented for the test to pass. |
Thanks, I bumped the version in |
@candleindark - could you please provide your feedback if any or approve this PR? |
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.
Everything looks fine to me.
@candleindark - fixed the branch merge requirements. merging. |
thanks @mvandenburgh for this PR. will you update the server to this release schema and python library? |
Fixes #244
This change allows Pydantic to generate more useful validation errors by making use of discriminated unions where possible.