@domenico
In FastAPI, you can hide input parameters by using the Query or Path function along with the ellipsis (...) symbol. Here's how you can do it:
1 2 3 4 5 6 7 |
from fastapi import FastAPI, Query app = FastAPI() @app.get("/items/") async def read_items(q: str = Query(..., description="Query parameter")): return {"q": q} |
1 2 3 4 5 6 7 |
from fastapi import FastAPI, Path app = FastAPI() @app.get("/items/{item_id}") async def read_item(item_id: int = Path(..., description="Item ID")): return {"item_id": item_id} |
By using the ellipsis (...) symbol in the parameter definition, you can effectively hide input parameters in FastAPI while still being able to use them in your API endpoints.