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

Update sub_types when calling update_forward_refs() #464

Merged
merged 4 commits into from Apr 11, 2019

Conversation

tiangolo
Copy link
Member

@tiangolo tiangolo commented Apr 5, 2019

Change Summary

Update sub_types when calling update_forward_refs()

update_forward_refs() currently updates a model's types by checking if they are ForwardRef.

This PR makes it also check sub-types, as would be needed for types like Union[ForwardRef('Node'), Leaf].

Related issue number

#404

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • include your github username @<whomever>

@codecov
Copy link

codecov bot commented Apr 5, 2019

Codecov Report

Merging #464 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #464   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          14     14           
  Lines        2220   2225    +5     
  Branches      435    437    +2     
=====================================
+ Hits         2220   2225    +5

pydantic/main.py Outdated Show resolved Hide resolved
@tiangolo
Copy link
Member Author

tiangolo commented Apr 5, 2019

This is ready for your review @samuelcolvin.

Let me know if you want me to move the function update_field_forward_refs from main.py to utils.py.

Copy link
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.

pydantic/main.py Outdated Show resolved Hide resolved
@samuelcolvin samuelcolvin merged commit 63afb45 into pydantic:master Apr 11, 2019
@tiangolo tiangolo deleted the forward-ref-subtypes branch April 11, 2019 15:14
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

2 participants