From 2cd89439e2f7379a5491296dc8853686db66a881 Mon Sep 17 00:00:00 2001 From: Ojuswi Rastogi Date: Mon, 9 Jun 2025 18:49:49 +0530 Subject: [PATCH] Fix: Serialize and Deserialize bytes Signed-off-by: Ojuswi Rastogi --- operate/resource.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/operate/resource.py b/operate/resource.py index 146f3b11..07ab141f 100644 --- a/operate/resource.py +++ b/operate/resource.py @@ -47,6 +47,8 @@ def serialize(obj: t.Any) -> t.Any: return [serialize(obj=value) for value in obj] if isinstance(obj, enum.Enum): return obj.value + if isinstance(obj, bytes): + return obj.hex() return obj @@ -85,6 +87,8 @@ def deserialize(obj: t.Any, otype: t.Any) -> t.Any: return Path(obj) if is_dataclass(otype): return otype.from_json(obj) + if otype is bytes: + return bytes.fromhex(obj) return obj