Skip to content

Commit ec17fa6

Browse files
fix: handle by_alias=None for Pydantic 2.10+ compatibility (#619)
Pydantic 2.10+ (pydantic-core 2.27+) rejects None for the by_alias parameter in model_dump(), raising TypeError. Coerce None to False to match the v1 fallback path behavior. Co-authored-by: viniciusdsmello <viniciusdsmello@users.noreply.github.com>
1 parent 08eddb5 commit ec17fa6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/openlayer/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def model_dump(
149149
exclude_defaults=exclude_defaults,
150150
# warnings are not supported in Pydantic v1
151151
warnings=True if PYDANTIC_V1 else warnings,
152-
by_alias=by_alias,
152+
by_alias=bool(by_alias) if by_alias is not None else False,
153153
)
154154
return cast(
155155
"dict[str, Any]",

0 commit comments

Comments
 (0)