mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-28 11:45:33 -04:00
✨ Allow hiding from OpenAPI (and Swagger UI) Query, Cookie, Header, and Path parameters (#3144)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
15
docs_src/query_params_str_validations/tutorial014.py
Normal file
15
docs_src/query_params_str_validations/tutorial014.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import FastAPI, Query
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(
|
||||
hidden_query: Optional[str] = Query(None, include_in_schema=False)
|
||||
):
|
||||
if hidden_query:
|
||||
return {"hidden_query": hidden_query}
|
||||
else:
|
||||
return {"hidden_query": "Not found"}
|
||||
Reference in New Issue
Block a user