コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 4 of about 4 for alias (0.005 sec.)
パスパラメータと数値の検証 11372
パスパラメータと数値の検証 クエリパラメータに対して Query でより多くのバリデーションとメタデータを宣言できるのと同じように、パスパラメータに対しても Path で同じ種類のバリデーションとメタデータを宣言することができます。 Pathのインポート まず ... _items ( item_id : int = Path ( title = "The ID of the item to get" ), q : Union [ str , None ] = Query ( default = None , alias = "item-query" ), ): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results ? Other versio ... ad_items ( item_id : Annotated [ int , Path ( title = "The ID of the item to get" )], q : Annotated [ str | None , Query ( alias = "item-query" )] = None , ): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results from ... ( item_id : Annotated [ int , Path ( title = "The ID of the item to get" )], q : Annotated [ Union [ str , None ], Query ( alias = "item-query" )] = None , ): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results from ...
https://man.mtool.work/fastapi/0.115/tutorial/path-params-numeric-validations/
クエリパラメータと文字列の検証 10762
クエリパラメータと文字列の検証 FastAPI ではパラメータの追加情報とバリデーションを宣言することができます。 以下のアプリケーションを例にしてみましょう: Python 3.8+ from typing import Union from fastapi import FastAPI app = FastAPI () @app . g ... ん。 最も近いのは item_query でしょう。 しかし、どうしても item-query と正確に一致している必要があるとします... それならば、 alias を宣言することができます。エイリアスはパラメータの値を見つけるのに使用されます: Python 3.8+ - non-Annotated from typing im ... Query app = FastAPI () @app . get ( "/items/" ) async def read_items ( q : Union [ str , None ] = Query ( default = None , alias = "item-query" )): results = { "items" : [{ "item_id" : "Foo" }, { "item_id" : "Bar" }]} if q : results . update ({ "q" : ... port FastAPI , Query app = FastAPI () @app . get ( "/items/" ) async def read_items ( q : Annotated [ str | None , Query ( alias = "item-query" )] = None ): results = { "items" : [{ "item_id" : "Foo" }, { "item_id" : "Bar" }]} if q : results . update ...
https://man.mtool.work/fastapi/0.115/tutorial/query-params-str-validations/
Release Notes 7526
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 ... ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12204 by @pre-commit-ci[bot] . 0.114.2 Fixes ? Fix form field regression with alias . PR #12194 by @Wurstnase . Translations ? Add Portuguese translation for docs/pt/docs/tutorial/request-form-models.md . P ... Pydantic Field() for: Path() Query() Header() Cookie() Body() Form() File() The new parameter fields are: default_factory alias_priority validation_alias serialization_alias discriminator strict multiple_of allow_inf_nan max_digits decimal_places jso ...
https://man.mtool.work/fastapi/0.115/release-notes/
レスポンスモデル 7286
レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union ... ケーションのOpenAPI(とドキュメント)で生成されたJSON Schemaが完全なモデルになるからです。 同様に動作する response_model_by_alias にも当てはまります。 Python 3.8+ from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = ...
https://man.mtool.work/fastapi/0.115/tutorial/response-model/
PREV 1 NEXT