-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Conversation
check for list not List in isinstance cast primitives returned by union property's _parse_*
- Added CHANGELOG entry - Change inner_properties_without_template to bool generated once - Change inner_properties_with_template to generator
Codecov Report
@@ Coverage Diff @@
## main #273 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 46 46
Lines 1314 1324 +10
=========================================
+ Hits 1314 1324 +10
Continue to review full report at Codecov.
|
There was a problem hiding this 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
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) | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Based on #268, fixes #266.