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.
Hi Hardik K (@hardikkaurani)
Accepting this PR in a minor would require another opt-in flag for the serializer, as we did for #310. Given the complexity of continuing to add opt-in serializer features, we had a protracted discussion about our serialization policy and settled on what's now documented by #355 . New additions to types supported by JsonDataConverter will be deferred indefinitely, until we start preparing for a new breaking change major release, and we will be accepting potentially-breaking change fixes for serialization of supported types only going forward, as we did in #346.
Closing the issue as not planned, customers who need MutableMapping and MutableSequence support can still get it via to_json/from_json implementations on their concrete classes, or a custom serializer.
Activity
andystaples commentedon Nov 23, 2026
Hi Hardik K (@hardikkaurani)
Accepting this PR in a minor would require another opt-in flag for the serializer, as we did for #310. Given the complexity of continuing to add opt-in serializer features, we had a protracted discussion about our serialization policy and settled on what's now documented by #355 . New additions to types supported by JsonDataConverter will be deferred indefinitely, until we start preparing for a new breaking change major release, and we will be accepting potentially-breaking change fixes for serialization of supported types only going forward, as we did in #346.
Closing the issue as not planned, customers who need MutableMapping and MutableSequence support can still get it via
to_json/from_jsonimplementations on their concrete classes, or a custom serializer.