Skip to content

fix(pydantic): add support for 'AwareDatetime' serialization#4503

Merged
provinzkraut merged 1 commit intolitestar-org:mainfrom
MetaHG:main
Nov 29, 2025
Merged

fix(pydantic): add support for 'AwareDatetime' serialization#4503
provinzkraut merged 1 commit intolitestar-org:mainfrom
MetaHG:main

Conversation

@MetaHG
Copy link
Copy Markdown
Contributor

@MetaHG MetaHG commented Nov 28, 2025

Description

This PR fixes a bug where pydantic.AwareDatetime was not being correctly mapped in PydanticDTO.

As AwareDatetime is a distinct type in Pydantic v2, it needs to be explicitly mapped to str in the _down_types dictionary so that the DTO backend handles serialization correctly.

Closes

Fixes #4502

@github-actions
Copy link
Copy Markdown

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/4503

Copy link
Copy Markdown
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@provinzkraut provinzkraut merged commit f3fb85a into litestar-org:main Nov 29, 2025
28 checks passed
provinzkraut pushed a commit that referenced this pull request Dec 13, 2025
Co-authored-by: MetaHG <25912337+MetaHG@users.noreply.github.com>

(cherry picked from commit f3fb85a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PydanticDTO fails to serialize Pydantic v2 AwareDatetime

2 participants