Skip to content

Commit cf8e701

Browse files
committed
Fix: unexpected coercing of values to the most-left type in a Union
1 parent a7909c0 commit cf8e701

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/osw/model/static.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ class Config:
9292
# Additional fields are ignored
9393
validate_assignment = True
9494
# Ensures that the assignment of a value to a field is validated
95+
smart_union = True
96+
# To avoid unexpected coercing of types, the smart_union option is enabled
97+
# See: https://docs.pydantic.dev/1.10/usage/model_config/#smart-union
98+
# Not required in v2 as this will become the new default
9599

96100
def __init__(self, **data):
97101
if data.get("label"):

0 commit comments

Comments
 (0)