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

forward refs support added. #61

Merged
merged 1 commit into from Jun 19, 2023
Merged

forward refs support added. #61

merged 1 commit into from Jun 19, 2023

Conversation

dapper91
Copy link
Owner

@dapper91 dapper91 commented Jun 19, 2023

fixes #60

This fix resolves the problem with postponed type declaration:

class TestModel(BaseXmlModel, tag='model1'):
    model1: 'TestSubModel' = element()

class TestSubModel(BaseXmlModel, tag='model2'):
    attr1: str = attr()

in suck case the type of the field model1 is ForwardRef and should be resolved after the TestSubModel model declared using update_forward_refs method.

TestModel.update_forward_refs()

@codecov-commenter
Copy link

Codecov Report

Merging #61 (22808c9) into dev (f6580e6) will decrease coverage by 0.66%.
The diff coverage is 87.17%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##              dev      #61      +/-   ##
==========================================
- Coverage   93.73%   93.08%   -0.66%     
==========================================
  Files          22       23       +1     
  Lines        1038     1085      +47     
==========================================
+ Hits          973     1010      +37     
- Misses         65       75      +10     
Flag Coverage Δ
unittests 93.08% <87.17%> (-0.66%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ydantic_xml/serializers/factories/heterogeneous.py 91.07% <66.66%> (-3.58%) ⬇️
pydantic_xml/serializers/factories/homogeneous.py 91.37% <66.66%> (-3.45%) ⬇️
pydantic_xml/serializers/factories/wrapper.py 92.68% <66.66%> (-4.76%) ⬇️
pydantic_xml/serializers/factories/union.py 87.80% <71.42%> (-2.79%) ⬇️
pydantic_xml/serializers/factories/forwardref.py 90.47% <90.47%> (ø)
pydantic_xml/model.py 100.00% <100.00%> (ø)
pydantic_xml/serializers/factories/__init__.py 100.00% <100.00%> (ø)
pydantic_xml/serializers/factories/model.py 95.28% <100.00%> (+0.13%) ⬆️
pydantic_xml/serializers/serializer.py 97.47% <100.00%> (+0.44%) ⬆️

@dapper91 dapper91 merged commit b81c46c into dev Jun 19, 2023
4 of 6 checks passed
@dapper91 dapper91 mentioned this pull request Jun 19, 2023
Merged
dapper91 added a commit that referenced this pull request Jun 19, 2023
- forward refs support added. See #61
@dapper91 dapper91 deleted the forward-refs branch June 23, 2023 15:19
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