Skip to content

Fix additionalProperty Union spacing and construction (#266) #273

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 13 commits into from
Dec 21, 2020
Merged

Conversation

dbanty
Copy link
Collaborator

@dbanty dbanty commented Dec 20, 2020

Based on #268, fixes #266.

@codecov
Copy link

codecov bot commented Dec 20, 2020

Codecov Report

Merging #273 (397d655) into main (e2d6e27) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #273   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           46        46           
  Lines         1314      1324   +10     
=========================================
+ Hits          1314      1324   +10     
Impacted Files Coverage Δ
openapi_python_client/__init__.py 100.00% <100.00%> (ø)
...penapi_python_client/parser/properties/__init__.py 100.00% <100.00%> (ø)
...penapi_python_client/parser/properties/property.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 e2d6e27...397d655. Read the comment docs.

@dbanty dbanty marked this pull request as ready for review December 20, 2020 18:18
@dbanty dbanty requested a review from emann December 20, 2020 18:19
@dbanty dbanty added this to the 0.7.3 milestone Dec 20, 2020
Copy link
Collaborator

@emann emann left a comment

Choose a reason for hiding this comment

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

One small question but other than that looks good

Comment on lines +164 to +168
def __attrs_post_init__(self) -> None:
super().__attrs_post_init__()
object.__setattr__(
self, "has_properties_without_templates", any(prop.template is None for prop in self.inner_properties)
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason for doing it this way vs. doing

@property
def has_properties_without_templates(self) -> bool:
    return any(prop.template is None for prop in self.inner_properties)

?

I guess this way may be a bit more efficient as its only being computed once

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The efficiency is exactly why. In the Template we need to reference this for each property to know whether or not we need an else, so it can get expensive to have to loop every time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah gotcha, definitely better this way then haha

@dbanty dbanty merged commit 20eed9e into main Dec 21, 2020
@dbanty dbanty deleted the issue-266 branch December 21, 2020 18:00
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.

Invalid python generated when using nested dictionaries
3 participants