You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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?
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).
The text was updated successfully, but these errors were encountered: