Results of 1 - 2 of about 2 for FilterParams (0.007 sec.)
- クエリパラメータモデル 11228
- クエリパラメータモデル もし関連する 複数のクエリパラメータ から成るグループがあるなら、それらを宣言するために、 Pydanticモデル を作成できます。 こうすることで、 複数の場所 で そのPydanticモデルを再利用 でき、バリデーションやメタデータを、す
...port Annotated , Literal from fastapi import FastAPI , Query from pydantic import BaseModel , Field app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "c...d_at" ] = "created_at" tags : list [ str ] = [] @app . get ( "/items/" ) async def read_items ( filter_query : Annotated [ FilterParams , Query ()]): return filter_query ? Other versions and variants Python 3.9+ Python 3.8+ Python 3.10+ - non-Annotated Pytho...PI , Query from pydantic import BaseModel , Field from typing_extensions import Annotated , Literal app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "c... - https://man.mtool.work/fastapi/0.115/tutorial/query-param-models/
- Release Notes 7485
- Release Notes Latest Changes 0.115.11 Fixes ? Add docs examples and tests (support) for Annotated custom validations, like AfterValidator , revert #13440 . PR #13442 by @tiangolo . New docs: Query Parameters and String Validations - Custom
...port Annotated , Literal from fastapi import FastAPI , Query from pydantic import BaseModel , Field app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "c...d_at" ] = "created_at" tags : list [ str ] = [] @app . get ( "/items/" ) async def read_items ( filter_query : Annotated [ FilterParams , Query ()]): return filter_query Read the new docs: Query Parameter Models . Header Parameter Models Use Pydantic models...port Annotated , Literal from fastapi import FastAPI , Query from pydantic import BaseModel , Field app = FastAPI () class FilterParams ( BaseModel ): model_config = { "extra" : "forbid" } limit : int = Field ( 100 , gt = 0 , le = 100 ) offset : int = Field... - https://man.mtool.work/fastapi/0.115/release-notes/
PREV
1
NEXT