Skip to content

Pydantic V2 Integration

TypeIDField

Bases: Generic[T]

Usage:

from typeid.integrations.pydantic import TypeIDField

class User(BaseModel):
    id: TypeIDField["user"]

This returns a specialized type that Pydantic will validate into your core TypeID.

__class_getitem__(item: str | tuple[str]) -> type[TypeID]

Support
  • TypeIDField["user"]
  • TypeIDField[Literal["user"]]
  • TypeIDField[("user",)]