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
{{ message }}
Repository navigation
Support MutableMapping and MutableSequence container traversal in JsonDataConverter and type discovery #352
While JsonDataConverter.can_reconstruct() and _coerce_generic() in durabletask/serialization.py support dict / Mapping, tuple, and list / Sequence containers, they currently omit collections.abc.MutableMapping and collections.abc.MutableSequence.
Because typing.get_origin() resolves MutableMapping[str, Model] to collections.abc.MutableMapping and MutableSequence[Model] to collections.abc.MutableSequence, can_reconstruct() returns False for these annotations:
Inbound type discovery in type_discovery.activity_input_type() and orchestrator_input_type() ignores these parameter annotations and returns None. Activities and orchestrators receiving input payloads annotated as MutableMapping or MutableSequence receive raw dicts and lists rather than coerced model instances.
Direct deserialization via converter.deserialize(payload, target_type=MutableMapping[str, MyModel]) leaves the inner values uncoerced.
Expected Behavior
JsonDataConverter.can_reconstruct() should recognize MutableMapping and MutableSequence annotations when their value/element types are reconstructable. In addition, _coerce_generic() should recursively coerce items for MutableMapping and MutableSequence container types.
Activity