-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix python client model class hydration issue #1221
Conversation
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
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.
Thank you for the quick fix!
T = TypeVar("T") | ||
|
||
|
||
class SerializableMixin: # pylint: disable=too-few-public-methods |
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.
This could be part of _internal module, but no big deal either way.
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.
Yeah, I originally had it there but it felt like that file got really long. This piece is pretty generic whereas that module is now mostly client models.
Summary
This fixes an issue where the python client's model classes weren't hydrating as dataclasses, but as dictionaries. For example, the expected type of
type(col)
here should beColumn
:This fixes things by adding a custom serializer from dictionaries to DJ model dataclasses:
SerializableMixin
. This mixin includes afrom_dict
method that will examine the structure of the dataclass and recursively convert a dictionary to the dataclass.Test Plan
make check
passesmake test
shows 100% unit test coverageDeployment Plan
N/A