Skip to content

Commit

Permalink
Accidentally removed array encoder (#80)
Browse files Browse the repository at this point in the history
Why
===

During #69 I fixed a bug with `Any` type derivation, in so doing I
neglected to account for array encoders.

```diff
     async def stageFiles(
         self,
-        input: Any,
+        input: GitStagefilesInput,
     ) -> GitStagefilesOutput:
```

This fixes the following:
```diff
-            lambda x: x,
+            lambda x: TypeAdapter(List[FooBarBaz]).dump_python(
+                x,  # type: ignore[arg-type]
+                by_alias=True,
+                exclude_none=True,
+            ),
```

What changed
============

- Avoid incorrectly stubbing out array encoders

Test plan
=========

Manually running confirmed the fix
  • Loading branch information
blast-hardcheese committed Sep 2, 2024
1 parent ecac798 commit aa1e501
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions replit_river/codegen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,9 @@ def __init__(self, client: river.Client[{handshake_type}]):
exclude_none=True,
)
""".rstrip()
if (
isinstance(procedure.input, RiverConcreteType)
and procedure.input.type != "object"
):
if isinstance(
procedure.input, RiverConcreteType
) and procedure.input.type not in ["object", "array"]:
render_input_method = "lambda x: x"

if output_type == "None":
Expand Down

0 comments on commit aa1e501

Please sign in to comment.