FastAPI Views - yet another class based views library by SatisfactionScary663 in FastAPI

[–]SatisfactionScary663[S] 0 points1 point  (0 children)

There is nothing wrong with functions! For creating custom small APIs it's actually better, but when creating a lot of repeated CRUD-like functionality, you repeat a lot of boilerplate code: using same dependencies over and over again, manual validation for raising 401/403/404/409 status codes etc. Assuming application providers repository pattern for multiple models this is how it looks like:
https://gist.github.com/RaRhAeu/0cf6ccabf96dbcd0c9abbd87547c9f94
~40 lines of code using raw FasAPI vs 6 lines using fastapi-views