Skip to content

feature/Keep DB schemas and API schemas separate. #6

@nathanieluriri

Description

@nathanieluriri
  1. Use TypedDict (or typed Motor collections) for repository/DB-layer static typing.
  2. Use Pydantic models for API input/output and runtime validation.
  3. Keep DB schemas and API schemas separate.

Why this split works:

  • TypedDict gives better autocomplete and mypy/pyright checks in DB code.
  • Pydantic enforces runtime correctness (types, coercion, constraints).
  • Mongo docs often include internal fields (_id, audit fields, partial projections) that should not leak to API models.

So: typed DB docs improve developer ergonomics, while separate Pydantic schemas improve correctness and boundary hygiene. This
hybrid is usually the strongest setup.

the creation should still work with fasterapi make-schema nothing seperate if at all something seperate should exist the thing is to create db schema's not even doing a seperate thing just to upgrade depracated stuff to allow them gain the benefits of a staticly typed database schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions