pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
392 B
17 lines
392 B
from typing import Annotated
|
|
from fastapi import Depends, FastAPI
|
|
|
|
app = FastAPI(depends_default_parallelizable=False)
|
|
|
|
async def dep_a() -> int:
|
|
return 1
|
|
|
|
async def dep_b() -> int:
|
|
return 2
|
|
|
|
@app.get("/items")
|
|
async def read_items(
|
|
a: Annotated[int, Depends(dep_a, parallelizable=True)],
|
|
b: Annotated[int, Depends(dep_b, parallelizable=True)],
|
|
):
|
|
return {"a": a, "b": b}
|
|
|