Coverage for docs_src/query_param_models/tutorial001_py39.py: 100%
12 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-04 08:29 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-04 08:29 +0000
1from fastapi import FastAPI, Query 1abcdef
2from pydantic import BaseModel, Field 1abcdef
3from typing_extensions import Literal 1abcdef
5app = FastAPI() 1abcdef
8class FilterParams(BaseModel): 1abcdef
9 limit: int = Field(100, gt=0, le=100) 1abcdef
10 offset: int = Field(0, ge=0) 1abcdef
11 order_by: Literal["created_at", "updated_at"] = "created_at" 1abcdef
12 tags: list[str] = [] 1abcdef
15@app.get("/items/") 1abcdef
16async def read_items(filter_query: FilterParams = Query()): 1abcdef
17 return filter_query 1ghijklmnopqrstuvwx