Skip to content

fix: handle by_alias=None for Pydantic 2.10+ compatibility#619

Merged
viniciusdsmello merged 1 commit intomainfrom
fix/pydantic-compat-by-alias
Mar 16, 2026
Merged

fix: handle by_alias=None for Pydantic 2.10+ compatibility#619
viniciusdsmello merged 1 commit intomainfrom
fix/pydantic-compat-by-alias

Conversation

@viniciusdsmello
Copy link
Contributor

Summary

  • Pydantic 2.10+ (pydantic-core 2.27+) rejects None for the by_alias parameter in model_dump(), raising TypeError: argument 'by_alias': 'NoneType' object cannot be converted to 'PyBool'
  • Coerce None to False in the v2 path to match the existing v1 fallback behavior on line 157

Context

This broke the Openlayer SDK when used with LangFlow 1.5.0 (which ships with Pydantic 2.10.6). The error occurs during _build_requestmodel_dumpmodel.model_dump(by_alias=None).

Test plan

  • Verify model_dump() works with Pydantic 2.10+ (by_alias no longer raises TypeError)
  • Verify backward compatibility with older Pydantic versions

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.
@claude
Copy link

claude bot commented Mar 16, 2026

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@viniciusdsmello viniciusdsmello merged commit ec17fa6 into main Mar 16, 2026
5 checks passed
@viniciusdsmello viniciusdsmello deleted the fix/pydantic-compat-by-alias branch March 16, 2026 16:59
@stainless-app stainless-app bot mentioned this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants