Skip to content
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

Introduce Embedded Model #924

Open
jpinner-lyft opened this issue Mar 19, 2021 · 1 comment
Open

Introduce Embedded Model #924

jpinner-lyft opened this issue Mar 19, 2021 · 1 comment

Comments

@jpinner-lyft
Copy link
Contributor

The existing MapAttribute structure contains a lot of complexity around subclassing.
MapAttributes are treated as either Attributes or AttributeContainers depending on where they are defined/created.
In addition, the behavior depends upon the value of is_raw which is usually tied to subclassing, except when subclasses override the definition (e.g. #868).

A simpler interface might be to restrict MapAttributes to always behaving as "raw" maps (even when in the DynamicMapAttribute case they could also be AttributeContainers with internal typed Attributes).

The existing subclass behavior would instead be supported via an "EmbeddedModel" class which would serialize to a dynamo Map but also behave as if you subclassed MapAttribute without overriding is_raw.

This would allow clean-up of the existing serialization logic and provide a better foundation for expanding the API in the future (e.g. treating all MapAttributes as python dictionaries).

@ikonst
Copy link
Contributor

ikonst commented Mar 29, 2021

If we implement this plan, existing code using MapAttribute would keep working except that attributes not defined in the schema would now also be mapped and accessible through the 'container'? Or would the code need to change to subclass either DynamicMapAttribute or EmbeddedModel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants