-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
Add support for more builtin pydantic v2 types #3101
Add support for more builtin pydantic v2 types #3101
Conversation
Thanks for adding the Here's a preview of the changelog: Adding support for additional pydantic built in types like EmailStr or PostgresDsn. Here's the preview release card for twitter: Here's the tweet text:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Can you add a release file?
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3101 +/- ##
==========================================
- Coverage 96.48% 96.45% -0.04%
==========================================
Files 469 469
Lines 29289 29293 +4
Branches 3611 3613 +2
==========================================
- Hits 28260 28255 -5
- Misses 846 851 +5
- Partials 183 187 +4 |
CodSpeed Performance ReportMerging #3101 will not alter performanceComparing Summary
|
for more information, see https://pre-commit.ci
@@ -35,7 +34,21 @@ | |||
(pydantic.RedisDsn, str), | |||
] | |||
if IS_PYDANTIC_V1 | |||
else [], | |||
else [ | |||
(pydantic.PositiveInt, int), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this gets to an equivalent state as far as testing goes with what we had in V1. I removed all the classes that don't exist anymore in pydanticv2, but kept all the ones that do still exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
9af0a58
to
863872c
Compare
Thanks for contributing to Strawberry! 🎉 You've been invited to join You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67 And don't forget to join our discord server: https://strawberry.rocks/discord 🔥 |
* Add support for more builtin pydantic v2 types * add release file * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add return type * Empty for codecov * Fix import --------- Co-authored-by: Patrick Pease <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Patrick Arminio <[email protected]>
Description
Previously when using Pydantic v2 there were several builtin pydantic types that were not supported like
EmailStr
orPostgresDsn
. In this PR, I am adding support for several of these built in types. I am also enabling the tests for these fields within the pydantic test suite.Types of Changes
Issues Fixed or Closed by This PR
EmailStr
and others can now be used as the type for a pydantic field.Checklist