Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add description to OpenAPI schema using FastApi Dependencies

Is there a way to add field description to FastAPI swagger schema if I use dependency system?

I see no place to add descriptions in simple example from FastAPI docs

async def common_parameters(q: str = None, skip: int = 0, limit: int = 100):
    return {"q": q, "skip": skip, "limit": limit} 
like image 428
Alveona Avatar asked May 14 '26 11:05

Alveona


1 Answers

You can also use this

@app.get("/dummy")
async def dummy(q: Optional[str] = Query(None, )):
    """
     This is my description of the API endpoint
    """
    pass
like image 114
Koushik Das Avatar answered May 17 '26 00:05

Koushik Das



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!