Debian Codegraph @

docs_src/query_params_str_validations/tutorial014_an_py310.py

raw
1 from typing import Annotated
2
3 from fastapi import FastAPI, Query
4
5 app = FastAPI()
6
7
8 @app.get("/items/")
9 async def read_items(
10 hidden_query: Annotated[str | None, Query(include_in_schema=False)] = None,
11 ):
12 if hidden_query:
13 return {"hidden_query": hidden_query}
14 else:
15 return {"hidden_query": "Not found"}