Skip to content

Commit 37565ef

Browse files
committed
[pid2] Allow optional arrays
We have optional arrays, and it would be real neat if we could codegen them. This change codegens them.
1 parent ff13eeb commit 37565ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/replit_river/codegen/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ def extract_props(tpe: RiverType) -> list[dict[str, RiverType]]:
629629
for y in x[{repr(name)}]
630630
]
631631
""".rstrip()
632+
+ (
633+
f" if x.get({repr(name)}) else None "
634+
if name not in prop.required
635+
else ""
636+
)
632637
)
633638
)
634639
else:

0 commit comments

Comments
 (0)