You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
crud.item and crud.user or any other functions are not injected as dependencies because they are static functions or variables used directly in the code of the route. FastAPI’s dependency injection is meant for dynamic values like db or current_user that change per request.
Basically if your value depends (that's the keyword here 😉) on the request content and can change or has to be regenerated per request you can use a dependency. If your function, variable or constant is the same for any request then it does not make sens to be a dependency and can be used directly in the body of your route.
Hi all, why in this and similiar examples crud.item(or user) not injected as dependency?
The text was updated successfully, but these errors were encountered: