Skip to content

Commit ecac798

Browse files
Reintroduce previous input encoder (#79)
Why === Follow-on to #78, but this looks like the last change that needed to be gated. What changed ============ Instead of testing if `base_model == 'TypedDict'`, we need to rely on the boolean that sets that into motion. Test plan ========= Manually run this codegen against production specs and verified no changes from the 0.4.0 release
1 parent c5299df commit ecac798

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

replit_river/codegen/client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,17 @@ def __init__(self, client: river.Client[{handshake_type}]):
520520
)
521521
""".rstrip()
522522

523-
render_input_method = f"encode_{input_type}"
523+
if typed_dict_inputs:
524+
render_input_method = f"encode_{input_type}"
525+
else:
526+
render_input_method = f"""\
527+
lambda x: TypeAdapter({input_type})
528+
.dump_python(
529+
x, # type: ignore[arg-type]
530+
by_alias=True,
531+
exclude_none=True,
532+
)
533+
""".rstrip()
524534
if (
525535
isinstance(procedure.input, RiverConcreteType)
526536
and procedure.input.type != "object"

0 commit comments

Comments
 (0)