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
* Fix custom serialization gaps from #154
Close several round-tripping gaps left by the type-aware custom
serialization work in #154, without introducing new breaking changes
versus 1.5.0 or any serialization-related security concerns.
Serialize side:
- Prefer a to_json() hook over the built-in dataclass / SimpleNamespace
handling so a dataclass (or namespace) with a non-serializable field can
opt in, mirroring the decode side which already prefers from_json().
- Encode dataclasses via a shallow field mapping instead of
dataclasses.asdict(), so nested to_json() hooks are honored and leaf
values are not deep-copied.
- Serialize enum.Enum values to their underlying .value so non-int enums
round-trip (IntEnum already serialized as integers).
Deserialize side:
- Recurse type-directed reconstruction into dict/Mapping values and tuple
elements, in addition to the existing list / Optional / Union / dataclass
recursion.
- Optionally pass the active DataConverter to a from_json(cls, value,
converter) hook so it can rebuild nested typed values the built-in
recursion does not cover.
Entity state:
- Defer deserialization of an entity's wire state until get_state() is
called, so the caller's requested type reaches the converter together
with the raw payload. Track whether the held value is still the raw
serialized string and pass it back through unchanged on persist to avoid
double-encoding.
- Replace a redundant serialize/deserialize round-trip in the legacy entity
event path with converter.coerce().
Module structure / deprecation:
- Merge the internal json_codec module into durabletask.serialization and
make the codec functions private; the supported surface is the pluggable
DataConverter.
- Deprecate durabletask.internal.shared.to_json / from_json with a
DeprecationWarning; they continue to work for backwards compatibility.
Adds a comprehensive JsonDataConverter round-trip test suite plus targeted
tests for each fix, and documents intentional limitations (multi-member
Union, types needing a custom converter such as datetime/Decimal/set).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address PR feedback
* Fix annotation discovery in 3.10
* Add pydantic example, fix reconstructibility concern
* More fixes:
- Rename is_reconstructible to can_reconstruct
- Correct ownership of _can_reconstruct
- Required DataConverter for internal classes
* CHANGELOG summarization
* No more silent fallbacks to JsonDataConverter
* PR feedback
* Final CHANGELOG tuneups
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments