Skip to content

fix: guard by_name kwarg for pydantic < 2.11 - #883

Open
xyf5432 wants to merge 1 commit into
litestar-org:mainfrom
xyf5432:fix/pydantic-by-name-guard
Open

xyf5432 wants to merge 1 commit into
litestar-org:mainfrom
xyf5432:fix/pydantic-by-name-guard

Conversation

@xyf5432

@xyf5432 xyf5432 commented Aug 26, 2026

Copy link
Copy Markdown

Fix #882

Guard the by_name=True argument in pydantic_factory.py behind a pydantic
version check: by_name was added to model_validate in pydantic 2.11.0.
On pydantic < 2.11 the factory now falls back to a plain model_validate
call, so the declared minimum version range (pydantic>=2.10.4) works with
__by_name__ = True as well.

Co-Authored-By: Claude <noreply@anthropic.com>
@xyf5432
xyf5432 requested a review from adhtruong as a code owner August 26, 2026 08:58
@xyf5432 xyf5432 changed the title Guard by_name kwarg for pydantic < 2.11 fix: guard by_name kwarg for pydantic < 2.11 Aug 26, 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.

Guard by_name kwarg for pydantic < 2.11

1 participant