Skip to content

Commit

Permalink
Reintroduce previous input encoder (#79)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
blast-hardcheese committed Sep 2, 2024
1 parent c5299df commit ecac798
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion replit_river/codegen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,17 @@ def __init__(self, client: river.Client[{handshake_type}]):
)
""".rstrip()

render_input_method = f"encode_{input_type}"
if typed_dict_inputs:
render_input_method = f"encode_{input_type}"
else:
render_input_method = f"""\
lambda x: TypeAdapter({input_type})
.dump_python(
x, # type: ignore[arg-type]
by_alias=True,
exclude_none=True,
)
""".rstrip()
if (
isinstance(procedure.input, RiverConcreteType)
and procedure.input.type != "object"
Expand Down

0 comments on commit ecac798

Please sign in to comment.