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 generic required #742

Merged
merged 3 commits into from Aug 11, 2019
Merged

Conversation

amitbl
Copy link

@amitbl amitbl commented Aug 11, 2019

Change Summary

Currently, required fields on GenericModel classes are being silently ignored and automatically being set to None as default value, This commit fixes this behavior, raising ValidationError when a value is not supplied.

Related issue number

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

codecov bot commented Aug 11, 2019

Codecov Report

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

@@          Coverage Diff           @@
##           v0.32.x   #742   +/-   ##
======================================
  Coverage      100%   100%           
======================================
  Files           15     15           
  Lines         2729   2729           
  Branches       541    541           
======================================
  Hits          2729   2729

@dmontagu
Copy link
Contributor

@samuelcolvin this looks good to me. (I'm not sure whether the change to VERSION should be part of this pull request or not.)

@amitbl good catch! Thanks for this.

@samuelcolvin
Copy link
Member

changing version is ok, this ambiguity will hopefully be fixed in v1 anyway, I would guess it's coped from #740.

@samuelcolvin samuelcolvin merged commit beaa902 into pydantic:v0.32.x Aug 11, 2019
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
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.

None yet

3 participants