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: forward ref with nested models and optional fields #1752

Merged
merged 2 commits into from Oct 8, 2020

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Jul 22, 2020

Change Summary

PR #1712 introduced a regression for forward refs in ModelField.prepare
as it would not return early for forward refs anymore.
Optional fields would hence have required set to True.

Related issue number

closes #1736

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)

PR pydantic#1712 introduced a regression for forward refs in `ModelField.prepare`
as it would not return early for forward refs anymore.
Optional fields would hence have `required` set to `True`.

closes pydantic#1736
@codecov
Copy link

codecov bot commented Jul 22, 2020

Codecov Report

Merging #1752 into master will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #1752   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3895      3895           
  Branches       783       783           
=========================================
  Hits          3895      3895           
Impacted Files Coverage Δ
pydantic/fields.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 e985857...fc2b237. Read the comment docs.

@samuelcolvin samuelcolvin merged commit a2fc01a into pydantic:master Oct 8, 2020
@samuelcolvin
Copy link
Member

great, thank you. Sorry it's taken me so long to get to this.

Does this need a patch release or can it wait until 1.7?

@PrettyWood
Copy link
Member Author

@samuelcolvin I guess it can wait as no issue has been opened since then for this issue

@PrettyWood PrettyWood deleted the fix-forwardref branch February 13, 2021 10:52
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.

Nested Models with optional members fail on 1.6.1
2 participants