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 }}
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
In the python SDK docs we have the following code snippet:
classDelivery(BaseModel):
timestamp: datetimedimensions: tuple[int, int]
classCompletedDelivery(BaseModel):
status: strtimestamp: datetime# For the input/output serialization of your handlers@my_object.handler()asyncdefdeliver(ctx: ObjectContext, delivery: Delivery) ->CompletedDelivery:
# To serialize stateawaitctx.get("delivery", serde=PydanticJsonSerde(Delivery))
ctx.set("delivery", delivery, serde=PydanticJsonSerde(Delivery))
# To serialize awakeable payloadsctx.awakeable(serde=PydanticJsonSerde(Delivery))
# To serialize the results of actionsawaitctx.run("some-task", some_task, serde=PydanticJsonSerde(Delivery))
# etc.returnCompletedDelivery(status="delivered", timestamp=datetime.now())
This is incorrect as the handler is unaware of how to deserialize the CompletedDelivery type correctly.
A relevant example for the issue is displayed further down on the page in this snippet:
# For the input/output serialization of your handlers@my_object.handler(input_serde=MySerde(), output_serde=MySerde())asyncdefmy_handler(ctx: ObjectContext, greeting: str) ->str:
...
where we learn how to pass deserializers to handlers.
So the correct pydantic example is
# For the input/output serialization of your handlers@my_object.handler(output_serde=PydanticJsonSerde(CompletedDelivery))asyncdefdeliver(ctx: ObjectContext, delivery: Delivery) ->CompletedDelivery:
...
In the python SDK docs we have the following code snippet:
This is incorrect as the
handleris unaware of how to deserialize theCompletedDeliverytype correctly.A relevant example for the issue is displayed further down on the page in this snippet:
where we learn how to pass deserializers to handlers.
So the correct pydantic example is