Skip to content

Commit 502c055

Browse files
Fix a bug where we were over-emitting encoder_ members for pydantic
1 parent 08a0acd commit 502c055

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/replit_river/codegen/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ def flatten_union(tpe: RiverType) -> list[RiverType]:
275275
encoder_name = TypeName(
276276
f"encode_{render_literal_type(type_name)}"
277277
)
278-
encoder_names.add(encoder_name)
278+
if base_model == "TypedDict":
279+
# "encoder_names" is only a TypedDict thing
280+
encoder_names.add(encoder_name)
279281
_field_name = render_literal_type(encoder_name)
280282
typeddict_encoder.append(
281283
f"""\

0 commit comments

Comments
 (0)