pydantic / pydantic-extra-types

Extra Pydantic types.
MIT License
181 stars 48 forks source link

Add phone number types #25

Closed JamesHutchison closed 1 year ago

JamesHutchison commented 1 year ago

This introduces a generic international phone number and a phone number type that defaults to the US. The default format includes extensions.

Feel free to comment heavily.

Addresses:

https://github.com/pydantic/pydantic/issues/1551 - phone number type, which quite a lot of attention

From https://github.com/pydantic/pydantic/issues/5012

JamesHutchison commented 1 year ago

I'm out of time. Will look at the issues caught by the CI later

yezz123 commented 1 year ago

Hello @JamesHutchison you can rebase this, and its will work!

I will give it a review!

yezz123 commented 1 year ago

I add some changes! and test it locally its works fine!

Thank you @JamesHutchison ⭐

asaah18 commented 1 year ago

Just to make sure, is the default format E.164 standard? As in, +9665xxxxxxxxwhere 966 is the country code?

JamesHutchison commented 1 year ago

The default format is RFC3966 which supports extensions

nameer commented 11 months ago

How to set the default region code or the format type while using PhoneNumber in a model?