Skip to content
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

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

Merged
merged 2 commits into from Aug 21, 2019

Conversation

@dmontagu
Copy link
Collaborator

dmontagu commented Aug 20, 2019

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

This comment has been minimized.

Copy link

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
Owner

samuelcolvin left a comment

otherwise LGTM.

@@ -807,6 +816,20 @@ def field_singleton_schema( # noqa: C901 (ignore complexity)
raise ValueError(f'Value not declarable with JSON Schema, field: {field}')


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

This comment has been minimized.

Copy link
@samuelcolvin

samuelcolvin Aug 20, 2019

Owner
Suggested change
field = Field(
return Field(

This comment has been minimized.

Copy link
@dmontagu

dmontagu Aug 21, 2019

Author Collaborator

my dreams of a one-commit pull request dashed

This comment has been minimized.

Copy link
@samuelcolvin

samuelcolvin Aug 21, 2019

Owner

sorry. 🙇

I'll try to stop being such a pedant (pun intended).

David Montague
@samuelcolvin samuelcolvin merged commit 080c288 into samuelcolvin:v0.32.x Aug 21, 2019
9 checks passed
9 checks passed
Header rules No header rules processed
Details
Pages changed All files already uploaded
Details
Redirect rules No redirect rules processed
Details
Mixed content No mixed content detected
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
samuelcolvin.pydantic Build #20190821.7 succeeded
Details
samuelcolvin.pydantic (Job Python36) Job Python36 succeeded
Details
samuelcolvin.pydantic (Job Python37) Job Python37 succeeded
Details
@samuelcolvin

This comment has been minimized.

Copy link
Owner

samuelcolvin commented Aug 21, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.