Skip to content

Fix error messages for Literal types with multiple allowed values#770

Merged
samuelcolvin merged 2 commits intopydantic:v0.32.xfrom
dmontagu:literal-schema-fix
Aug 21, 2019
Merged

Fix error messages for Literal types with multiple allowed values#770
samuelcolvin merged 2 commits intopydantic:v0.32.xfrom
dmontagu:literal-schema-fix

Conversation

@dmontagu
Copy link
Copy Markdown
Contributor

Change Summary

Fix error messages for Literal types with multiple allowed values

Related issue number

Fixes #768

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.rst file added describing change
    (see changes/README.md for details)

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 20, 2019

Codecov Report

Merging #770 into v0.32.x will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           v0.32.x   #770   +/-   ##
======================================
  Coverage      100%   100%           
======================================
  Files           15     15           
  Lines         2733   2736    +3     
  Branches       543    543           
======================================
+ Hits          2733   2736    +3

Copy link
Copy Markdown
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM.

Comment thread pydantic/schema.py Outdated


def multivalue_literal_field_for_schema(values: Tuple[Any, ...], field: Field) -> Field:
field = Field(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
field = Field(
return Field(

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Member

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).

@samuelcolvin samuelcolvin merged commit 080c288 into pydantic:v0.32.x Aug 21, 2019
@samuelcolvin
Copy link
Copy Markdown
Member

thanks so much.

samuelcolvin added a commit that referenced this pull request Oct 1, 2019
* 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
andreshndz pushed a commit to cuenca-mx/pydantic that referenced this pull request Jan 17, 2020
* 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
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants