Uh oh!
There was an error while loading. Please reload this page.
fix: Fix deserialization of non-required properties - #334
Conversation
forest-benchling
commented
Feb 10, 2021
Codecov Report
@@ Coverage Diff @@## main #334 +/- ##
=========================================
Coverage 100.00% 100.00% =========================================
Files 47 47 Lines 1390 1390 =========================================
Hits 1390 1390 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Odd, I'd think that black would have removed that.
There was a problem hiding this comment.
Yeah, I couldn't figure out why that got added by my PR...
| template = env.get_template("date_property_template.py") | ||
| content = template.render(property=prop) | ||
| print(content) |
There was a problem hiding this comment.
| print(content) |
forest-benchling
commented
Feb 10, 2021
@dbanty Yeah, I think we can merge this one first and I'll address the conflicts on #332, since it has more changes to be addressed |
Previously, a non-required datetime would generate code like this in the
from_dict:The
ifstatement is incorrect as it does not check forUnset, and furthermore thecast(which is best to avoid using when possible) masks the issue.This had already been fixed for models in #315, but not for dates, datetimes, enums, or files.
In this PR, I pulled out the shared logic into a higher-order macros
construct_template, in order to fix the issue across the board.