Skip to content

Commit

Permalink
[bug/client codegen] local_discriminator should be stable (#104)
Browse files Browse the repository at this point in the history
What changed and Why
===

When there are multiple discriminator choices, we should just choose the
first one.

Test plan
=========

Manual verification via repl
  • Loading branch information
blast-hardcheese authored Nov 5, 2024
1 parent c3a7da3 commit 6405ae8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion replit_river/codegen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def flatten_union(tpe: RiverType) -> list[RiverType]:
""".strip()
)
if local_discriminators:
local_discriminator = local_discriminators.pop()
local_discriminator = sorted(local_discriminators).pop()
else:
local_discriminator = "FIXME: Ambiguous discriminators"
typeddict_encoder.append(
Expand Down

0 comments on commit 6405ae8

Please sign in to comment.