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

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



scroll to zoom in/out

pick tag/routes at left panel, and see subgraphs

double click to see field table and source code, click link to see source code in github

click focus to hide other nodes.

...


this project is inspired by https://apis.guru/graphql-voyager/, which visualize the entity relationships based on graphviz and add fancy ui effects.

fastapi-voyager, from left to right, is tag, routes(apis) and response_models, it indicates the internal relationship between routes, which can help developers/PO easily figure out the data structure.


ok, how is this better than OpenAPI schema???


in swagger, from the definition of schema you are not able to easily figure out the related class, the name is marked as <object> or array<object>

in voyager their relationships are visualized and very close to the source code.


What are the files like router.sample_1.schema? Is that a convention you use for your Pydantic models or something generated by OpenApi?


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

those are clusters based on modules, you can swith off by toggle 'show module cluster'


So this isn't really "visualize FastAPI endpoints", it's "visualize the inheritance cascade caused by using the pydantic-resolve approach to data fetching/transformation, which involves adding post-hooks to compositions of Pydantic objects". A vanilla FastAPI user like myself is going to have trouble understanding it without realizing how tied it is to that framework.


While at it, what do you use to parse / validate / cast request data into nice typechecked objects?


the return value in resolve/post method will be automatically validated by the pydantic class defined in field annotation.


to better describe the relationship, it borrows the concept 'subset' from pydantic-resolve, which act like pick several fields from original class but you can still reference to it.

@subset(User) class PickedUser: ....


it's not bound with pydantic-resolve, for vanilla fastapi user if the business model are well designed and composed, it can benefited from this visualization approach too.

the goal is to make the dependencies clear for developers, and figure out the potential impacts from one node to others.

pydantic-resolve is just another my project to make the process of data composition close to ER model and get rid of glue codes like 'for loops'.


This seems to show much deeper into the backend... OpenAPI really only shows the API surface as kind of a black box for external usage... this seems to be to aid diagnostics and understanding of internal calls and relationships.


you are right, in fact the most valuable part in our backend is 'business mode/logic', with voyager we can have a new choice to better understand them.


Pretty nice


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

Search: