Skip to content

Latest commit

 

History

History
72 lines (45 loc) · 1.89 KB

File metadata and controls

72 lines (45 loc) · 1.89 KB

Framework Integrations

TypeID is designed to be framework-agnostic. The core package does not depend on any web framework, ORM, or serialization library.

Integrations are provided as optional adapters that translate between TypeID and specific ecosystems. They are installed explicitly and never affect the core unless imported.


Available integrations

Pydantic (v2)

Native support for using TypeID in Pydantic v2 models.

  • Prefix-aware validation
  • Accepts str and TypeID
  • Serializes as string
  • Clean JSON Schema / OpenAPI output
pip install typeid-python[pydantic]

See: Pydantic v2 documentation page for details and examples.

FastAPI

FastAPI builds on Pydantic v2, so TypeID works automatically in:

  • request models
  • response models
  • OpenAPI schemas

No separate FastAPI-specific adapter is required.

pip install typeid-python[fastapi]

See: Pydantic v2 documentation page for details and examples.

SQLAlchemy

Column types for storing TypeIDs in relational databases.

Typical usage stores the full TypeID string (prefix_suffix) for clarity and debuggability.

pip install typeid-python[sqlalchemy]

See: Pydantic v2 documentation page for details and examples.

Design notes

  • The TypeID core never imports framework code
  • Validation rules live in the core, not in adapters
  • Integrations are thin and easy to replace or extend

This keeps the library stable even as frameworks evolve.

Adding new integrations

If you want to integrate TypeID with another framework:

  • keep the adapter small,
  • avoid duplicating validation logic,
  • depend on the TypeID core as the single source of truth.

Community integrations are welcome.