mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-29 00:11:16 -05:00
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
19 lines
423 B
Python
19 lines
423 B
Python
from typing import Optional
|
|
|
|
from fastapi import Depends, FastAPI
|
|
from typing_extensions import Annotated
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
async def common_parameters(q: Optional[str] = None, skip: int = 0, limit: int = 100):
|
|
return {"q": q, "skip": skip, "limit": limit}
|
|
|
|
|
|
CommonParamsDepends = Annotated[dict, Depends(common_parameters)]
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(commons: CommonParamsDepends):
|
|
return commons
|