-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix error messages for Literal types with multiple allowed values #770
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
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.32.x #770 +/- ##
======================================
Coverage 100% 100%
======================================
Files 15 15
Lines 2733 2736 +3
Branches 543 543
======================================
+ Hits 2733 2736 +3 |
samuelcolvin
left a comment
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.
otherwise LGTM.
pydantic/schema.py
Outdated
|
|
||
|
|
||
| def multivalue_literal_field_for_schema(values: Tuple[Any, ...], field: Field) -> Field: | ||
| field = Field( |
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.
| field = Field( | |
| return Field( |
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.
my dreams of a one-commit pull request dashed
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.
sorry. 🙇♂️
I'll try to stop being such a pedant (pun intended).
|
thanks so much. |
* fix(validate-assignment): do not validate extra fields when `vaidate_assignment` is on * Update history * Fix `value` vs. `value_` * Add tests for `value` vs `value_` case * uprev * Fix generic required (#742) * Fix required fields on GenericModel * lint * version up * __post_init__ with inheritance, fix #739 (#740) * Fix custom Schema on GenericModel fields (#754) * Fix custom Schema on GenericModel fields * Add PR# * uprev * Fix error messages for Literal types with multiple allowed values (#770) * Fix error messages for Literal types with multiple allowed values * Incorporate feedback * update history
* fix(validate-assignment): do not validate extra fields when `vaidate_assignment` is on * Update history * Fix `value` vs. `value_` * Add tests for `value` vs `value_` case * uprev * Fix generic required (pydantic#742) * Fix required fields on GenericModel * lint * version up * __post_init__ with inheritance, fix pydantic#739 (pydantic#740) * Fix custom Schema on GenericModel fields (pydantic#754) * Fix custom Schema on GenericModel fields * Add PR# * uprev * Fix error messages for Literal types with multiple allowed values (pydantic#770) * Fix error messages for Literal types with multiple allowed values * Incorporate feedback * update history
Co-authored-by: Samuel Colvin <[email protected]>
Change Summary
Fix error messages for Literal types with multiple allowed values
Related issue number
Fixes #768
Checklist
changes/<pull request or issue id>-<github username>.rstfile added describing change(see changes/README.md for details)