Extra

For types that are more complex, you can find external libraries that provide additional Pydantic-compatible types. For example, the Pydantic Extra Types project.

External dependency

To use this project, you need to install the optional pydantic-extra-types package:

pip install pydantic-extra-types
uv add pydantic-extra-types

The following non-exhaustive list of types are supported by Pydantic Extra Types:

  • Color Types: color validation types.
  • Payment Card Numbers: a type that allows you to store payment card numbers in your model.
  • Phone Numbers: a type that allows you to store phone numbers in your model.
  • Routing Numbers: a type that allows you to store ABA transit routing numbers in your model.
  • MAC Address: a type that allows you to store MAC addresses in your model.