Skip to content

Commit 570eeb1

Browse files
bchamppAlex Wang
authored andcommitted
fix: add to_dict() for CheckpointUpdatedExecutionState and fix deserialization for CheckpointDurableExecutionRequest
1 parent c2bc80d commit 570eeb1

File tree

1 file changed

+19
-6
lines changed
  • src/aws_durable_execution_sdk_python_testing

1 file changed

+19
-6
lines changed

src/aws_durable_execution_sdk_python_testing/model.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,15 @@ def from_dict(cls, data: dict) -> CheckpointUpdatedExecutionState:
19451945
next_marker=data.get("NextMarker"),
19461946
)
19471947

1948+
def to_dict(self) -> dict[str, Any]:
1949+
"""Convert to dictionary representation."""
1950+
result: dict[str, Any] = {
1951+
"Operations": [op.to_dict() for op in self.operations],
1952+
}
1953+
if self.next_marker is not None:
1954+
result["NextMarker"] = self.next_marker
1955+
return result
1956+
19481957
def to_dict(self) -> dict[str, Any]:
19491958
result: dict[str, Any] = {
19501959
"Operations": [op.to_dict() for op in self.operations]
@@ -1985,20 +1994,24 @@ def from_dict(
19851994
error=ErrorObject.from_dict(update_data["Error"])
19861995
if update_data.get("Error")
19871996
else None,
1988-
context_options=ContextOptions(**update_data["ContextOptions"])
1997+
context_options=ContextOptions.from_dict(
1998+
update_data["ContextOptions"]
1999+
)
19892000
if update_data.get("ContextOptions")
19902001
else None,
1991-
step_options=StepOptions(**update_data["StepOptions"])
2002+
step_options=StepOptions.from_dict(update_data["StepOptions"])
19922003
if update_data.get("StepOptions")
19932004
else None,
1994-
wait_options=WaitOptions(**update_data["WaitOptions"])
2005+
wait_options=WaitOptions.from_dict(update_data["WaitOptions"])
19952006
if update_data.get("WaitOptions")
19962007
else None,
1997-
callback_options=CallbackOptions(**update_data["CallbackOptions"])
2008+
callback_options=CallbackOptions.from_dict(
2009+
update_data["CallbackOptions"]
2010+
)
19982011
if update_data.get("CallbackOptions")
19992012
else None,
2000-
chained_invoke_options=ChainedInvokeOptions(
2001-
**update_data["ChainedInvokeOptions"]
2013+
chained_invoke_options=ChainedInvokeOptions.from_dict(
2014+
update_data["ChainedInvokeOptions"]
20022015
)
20032016
if update_data.get("ChainedInvokeOptions")
20042017
else None,

0 commit comments

Comments
 (0)