-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ZoneInfo in BaseModel #103
Comments
Thanks for submitting this feature request. Seems reasonable - I'd be more than happy to review a PR adding this feature 😄. Is this something you'd be interested in opening a PR for? |
Sure, I don't mind giving this a go |
Maybe something that would make more sense in |
Is it correct that supporting this in |
Yep, you'd want to create a type that subclasses from You can also take this approach in order to support |
Initial Checks
Description
I feel like it should be possible to create a
BaseModel
with aZoneInfo
(or pydantic'sTzInfo
) like in the snippet below. If you try to run this, aPydanticSchemaGenerationError
is raised. pydantic/pydantic#4987 reported the same thing, but was closed by the author after working around the issue.Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: