mirror of
https://github.com/fastapi/fastapi.git
synced 2026-07-28 23:57:37 -04:00
📝 Move tutorial src files to top level docs
This commit is contained in:
22
docs/src/query_params_str_validations/tutorial010.py
Normal file
22
docs/src/query_params_str_validations/tutorial010.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from fastapi import FastAPI, Query
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(
|
||||
q: str = Query(
|
||||
None,
|
||||
alias="item-query",
|
||||
title="Query string",
|
||||
description="Query string for the items to search in the database that have a good match",
|
||||
min_length=3,
|
||||
max_length=50,
|
||||
regex="^fixedquery$",
|
||||
deprecated=True,
|
||||
)
|
||||
):
|
||||
results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
|
||||
if q:
|
||||
results.update({"q": q})
|
||||
return results
|
||||
Reference in New Issue
Block a user