Skip to content

Correct path in nested models #437

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

Merged
merged 3 commits into from
Mar 28, 2019
Merged

Correct path in nested models #437

merged 3 commits into from
Mar 28, 2019

Conversation

kataev
Copy link
Contributor

@kataev kataev commented Mar 28, 2019

Hello, i find what first part of path is missed on errors in nested models.
Here the fix and tests.

@codecov
Copy link

codecov bot commented Mar 28, 2019

Codecov Report

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

@@          Coverage Diff          @@
##           master   #437   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          14     14           
  Lines        2157   2160    +3     
  Branches      426    427    +1     
=====================================
+ Hits         2157   2160    +3

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 looks good, thank you.


def test_nested_error():
class NestedModel1(BaseModel):
class NestedModel2(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this a bit confusing, no need to nest the class definitions, just

class NestedModel3(BaseModel):
    x: str

class NestedModel2(BaseModel):
    data2: List[NestedModel3]

class NestedModel1(BaseModel):
    data1: List[NestedModel2]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

HISTORY.rst Outdated
@@ -7,6 +7,7 @@ v0.21.1 (unreleased)
....................
* add ``IPv{4,6,Any}Network`` and ``IPv{4,6,Any}Interface`` types from ``ipaddress`` stdlib, #333 by @pilosus
* add docs for ``datetime`` types, #386 by @pilosus
* fix path in nested models, by @kataev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add PR number here as per other entries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also will need resolve conflicts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, already

@kataev
Copy link
Contributor Author

kataev commented Mar 28, 2019

Well, what next?

@samuelcolvin samuelcolvin merged commit fa65a07 into pydantic:master Mar 28, 2019
@samuelcolvin
Copy link
Member

Awesome, thank you very much.

I'll try and wait for #428 to deploy, but if that takes a long time I'll deploy this in a few days. Hope that's okay.

@kataev
Copy link
Contributor Author

kataev commented Mar 28, 2019

Yep, no problem.

alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
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.

2 participants