mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-31 02:00:34 -05:00
* ✨ Do not require default value in Query(), Path(), Header(), etc * 📝 Update source examples for docs with default and required values * ✅ Update tests with new default values and not required Ellipsis * 📝 Update docs for Query params and update info about default value, required, Ellipsis
16 lines
329 B
Python
16 lines
329 B
Python
from typing import Union
|
|
|
|
from fastapi import FastAPI, Query
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(
|
|
hidden_query: Union[str, None] = Query(default=None, include_in_schema=False)
|
|
):
|
|
if hidden_query:
|
|
return {"hidden_query": hidden_query}
|
|
else:
|
|
return {"hidden_query": "Not found"}
|