Skip to content

Commit 8636249

Browse files
Disambiguate slips between input and init
1 parent f505228 commit 8636249

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

replit_river/codegen/client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,12 @@ def __init__(self, client: river.Client[{handshake_type}]):
534534
for name, procedure in schema.procedures.items():
535535
init_type: Optional[str] = None
536536
if procedure.init:
537-
init_type, input_chunks = encode_type(
537+
init_type, init_chunks = encode_type(
538538
procedure.init,
539539
f"{schema_name.title()}{name.title()}Init",
540540
base_model=input_base_class,
541541
)
542-
chunks.extend(input_chunks)
542+
chunks.extend(init_chunks)
543543
input_type, input_chunks = encode_type(
544544
procedure.input,
545545
f"{schema_name.title()}{name.title()}Input",
@@ -584,12 +584,12 @@ def __init__(self, client: river.Client[{handshake_type}]):
584584
""".rstrip()
585585

586586
# Init renderer
587-
if typed_dict_inputs and init_type:
588-
if is_literal(procedure.input):
587+
if typed_dict_inputs and init_type and procedure.init:
588+
if is_literal(procedure.init):
589589
render_init_method = "lambda x: x"
590590
elif isinstance(
591-
procedure.input, RiverConcreteType
592-
) and procedure.input.type in ["array"]:
591+
procedure.init, RiverConcreteType
592+
) and procedure.init.type in ["array"]:
593593
assert init_type.startswith(
594594
"List["
595595
) # in case we change to list[...]
@@ -601,7 +601,7 @@ def __init__(self, client: river.Client[{handshake_type}]):
601601
render_init_method = f"encode_{init_type}"
602602
else:
603603
render_init_method = f"""\
604-
lambda x: TypeAdapter({input_type})
604+
lambda x: TypeAdapter({init_type})
605605
.validate_python
606606
""".rstrip()
607607

0 commit comments

Comments
 (0)