FastAPI - Dependency Injection
What is the error in the following FastAPI code using sub-dependencies?
from fastapi import FastAPI, Depends
app = FastAPI()
def sub_dep():
return "data"
def main_dep(data: str = Depends(sub_dep)):
return data
@app.get("/test")
async def test_endpoint(info: str = Depends(main_dep())):
return {"info": info}