mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-15 01:21:20 -05:00
* ✨ Refactor parameter dependency using Pydantic Field * ⬆️ Upgrade required Pydantic version with latest Shape values * ✨ Add tutorials and code for using Enum and Optional * ✅ Add tests for tutorials with new types and extra cases * ♻️ Format, clean, and add annotations to dependencies.utils * 📝 Update tutorial for query parameters with list defaults * ✅ Add tests for query param with list default
12 lines
209 B
Python
12 lines
209 B
Python
from typing import List
|
|
|
|
from fastapi import FastAPI, Query
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(q: List[str] = Query(["foo", "bar"])):
|
|
query_items = {"q": q}
|
|
return query_items
|