Hacker Newsnew | past | comments | ask | show | jobs | submit | tank-34's commentslogin


declare the relationship:

class Story(BaseModel, BaseEntity):

    __pydantic_resolve_relationships__ = [
        Relationship( field='id', target_kls=list[task_schema.Task], loader=task_loader.story_to_task_loader),
        Relationship( field='owner_id', target_kls=user_schema.User, loader=user_loader.user_batch_loader)
    ]

    id: int
    name: str
    owner_id: int
    sprint_id: int

    model_config = ConfigDict(from_attributes=True)
and consume it

class Story1(DefineSubset):

    __subset__ = (BaseStory, ('id', 'name', 'owner_id'))

    tasks: Annotated[list[Task1], LoadBy('id')] = []
    assignee: Annotated[Optional[BaseUser], LoadBy('owner_id')] = None

    related_users: list[BaseUser] = []
    def post_related_users(self, collector=Collector(alias='related_users')):
        return collector.values()


In the new version, an ER model at the application layer was designed to better describe the business model and manage the DataLoader. Developers can focus more on describing the relationships between data without worrying prematurely about databases or other query details.


Clean Architecture Practice with Pydantic-Resolve and FastAPI-Voyager


A solid tool for building fixed graph-like data.

Easily construct complex business data by defining ER diagrams, combining data, and applying various data adjustment methods

Minimal cognitive load

Extremely developer-friendly for those with GraphQL experience, helping improve the code quality and maintainability of API integrations

When combined with fastapi-voyager, it allows visualizing the constructed code graphically


toggle the 'ER diagram' and show the full picture in graph

application level ER diagram can provide much more information for business entities and hide unnecesary middle tables.

definition: https://github.com/allmonday/composition-oriented-developmen...

fastapi-voyager itself is also improved a lot for better experiences.


https://github.com/allmonday/fastapi-voyager

Visualize your FastAPI endpoints, and explore them interactively.

- better search experience - better graph interaction - persistent page in query string


if you double click route / pydantic class and click 'view in vscode', it will lead you to the file in github

and in local env, you can 'really' open it in vscode.


thanks for suggestion. this project is still in early stage, I've listed some ux related Todos but not yet finished. TBH, i dont expected it to be noticed in hacker's news LOL



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: