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: allow None for type Optional[conset / conlist] #2321

Merged
merged 1 commit into from Feb 13, 2021

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Feb 5, 2021

Change Summary

We were not handling the None case in set_length_validator causing issues when Optional[conset(...)] type had a set value equal to None.
Furthermore the check on required for conlist was wrong as Optional means "nullable" and we can have required nullables

Related issue number

closes #2320

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>.md file added describing change
    (see changes/README.md for details)

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #2321 (84afe71) into master (13a5c7d) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #2321   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         4199      4201    +2     
  Branches       854       855    +1     
=========================================
+ Hits          4199      4201    +2     
Impacted Files Coverage Δ
pydantic/types.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13a5c7d...84afe71. Read the comment docs.

@PrettyWood PrettyWood changed the title fix: allow None for type Optional[conset(...)] fix: allow None for type Optional[conset / conlist] Feb 5, 2021
@samuelcolvin
Copy link
Member

thanks a lot.

@PrettyWood PrettyWood deleted the conset-none branch February 13, 2021 17:29
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.

BaseSetting Optional[conset(...)] not validated correctly
2 participants