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
DM-37214: Fix problem with JSON formatter when Pydantic is used but Dict requested #761
Conversation
Now that read storage class being different to write storage class no longer directly means that a component is being used, the logic in FileFormatter to extract a component has to change. 1. The extraction must happen from the original python type that was written and not the, possibly, generic python type read from disk. This requires we do a coercion before extracting the component. 2. Built-in types must always be converted to the original storage class before conversion to the requested read storage class. 3. Remove duplicate logic from JSON and YAML that was trying to convert built-in types to the requested type. This now has moved to the parent class.
Codecov ReportBase: 85.32% // Head: 85.37% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #761 +/- ##
==========================================
+ Coverage 85.32% 85.37% +0.05%
==========================================
Files 260 261 +1
Lines 34560 34605 +45
Branches 5819 5816 -3
==========================================
+ Hits 29488 29544 +56
+ Misses 3826 3818 -8
+ Partials 1246 1243 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View 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.
Looks good. Only comment is probably a case of idle musing about future possibilities.
Remove the requirement that we only do this if we did not write it originally as a built-in type -- it didn't really affect the code because of the presence of the isinstance check later on (which has now moved into the main check).
9a824dc
to
d2a36d9
Compare
Test that we can round trip Pydantic models, dataclasses, classes that get created from dicts, and tuples using JSON and YAML formatters.
ece5f9a
to
c2e3f5e
Compare
JSON natively reads
dict
and so was never triggering the conversion code to the proper internal type before converting that to a dict. ForTaskMetadata
this could lead to oddities because the dict view ofTaskMetadata
does not match the internal model layout.Checklist
doc/changes