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
Collaborator

@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 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

Loading

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

@tiangolo 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.

Loading

Copy link
Owner

@samuelcolvin samuelcolvin left a comment

otherwise LGTM.

Loading

pydantic/main.py Outdated Show resolved Hide resolved
Loading
@samuelcolvin samuelcolvin merged commit 63afb45 into samuelcolvin:master Apr 11, 2019
7 checks passed
Loading
@tiangolo tiangolo deleted the forward-ref-subtypes branch Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants