Closed idbentley closed 1 year ago
@george-zubrienko and @pawelwilczewski Building on #464 I added simple support for iterating over available dataclasses
when deserializing objects withou __type
specifiers.
I don't see what you mean @george-zubrienko . The logic change I added in core.py
is adding an if
check for each dataclass in the type_options
, which catches potential decoding errors in order to test each dataclass, until a suitable one (or none is found).
@idbentley See what the final PR looked like. As per @george-zubrienko suggestion, I refactored the file a bit before finalising the PR.
Oh, I see! Sorry, I misunderstood your comment @george-zubrienko ! I've updated it to match recommended style!
Hi @george-zubrienko . Would love to see this PR get a review as it will enable a feature to be completed on my team.
I updated the style (as you asked) last week, and and rebased from master today.
Thanks for your consideration!
Hi @george-zubrienko . Would love to see this PR get a review as it will enable a feature to be completed on my team.
I updated the style (as you asked) last week, and and rebased from master today.
Thanks for your consideration!
Hello :) no worries I'll review/merge this week. Github also made a mess recently, which impacts our ability to release to PyPI, thus I cannot guarantee a PyPI release this week. Sep 14 is when GH engineering should provide a solution - or so I was told. Stay tuned for updates.
Pleasant discussion, elaborate reasoning, all-around great PR. Time to merge!
Great working with you @george-zubrienko ! Thanks for all the help.
This pull request adds a best-effort deserialization to Union types when no
__type
field specifier is present.In the case that no
__type
field is present, a warning is issued describing the risk of such unmarshalling attempt.We attempt to decode ensuring that keys exist on the type, and the values are appropriate. If either of these conditions fails, we abandon that dataclass type, and move onto the next one.
If no type is found, a warning is issued, the value is not decoded, and is left as-is.