コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 13 for Tags (0.003 sec.)
Path Operationの設定 11894
Path Operationの設定 path operationデコレータ を設定するためのパラメータがいくつかあります。 注意 これらのパラメータは path operation関数 ではなく、 path operationデコレータ に直接渡されることに注意してください。 レスポンスステータスコード ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : Set [ str ] = set () @app . post ( "/items/" , response_model = Item , status_code = status . HTTP_201_CREATED ) async d ... = FastAPI () class Item ( BaseModel ): name : str description : str | None = None price : float tax : float | None = None tags : set [ str ] = set () @app . post ( "/items/" , response_model = Item , status_code = status . HTTP_201_CREATED ) async d ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : set [ str ] = set () @app . post ( "/items/" , response_model = Item , status_code = status . HTTP_201_CREATED ) async d ...
https://man.mtool.work/fastapi/0.115/tutorial/path-operation-configuration/
Bigger Applications - Multiple Files 10627
Bigger Applications - Multiple Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you are building an application or a web API, it's rarely the case that you ... h the class FastAPI : app/routers/users.py from fastapi import APIRouter router = APIRouter () @router . get ( "/users/" , tags = [ "users" ]) async def read_users (): return [{ "username" : "Rick" }, { "username" : "Morty" }] @router . get ( "/users ... /me" , tags = [ "users" ]) async def read_user_me (): return { "username" : "fakecurrentuser" } @router . get ( "/users/ {username} " ... , tags = [ "users" ]) async def read_user ( username : str ): return { "username" : username } Path operations with APIRouter And ...
https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
Generate Clients 10539
Generate Clients Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the OpenAPI specification, you get automatic compatibility with many tools, ... ou will have inline errors for the data that you send: The response object will also have autocompletion: FastAPI App with Tags In many cases your FastAPI app will be bigger, and you will probably use tags to separate different groups of path operati ... ons . For example, you could have a section for items and another section for users , and they could be separated by tags: Python 3.9+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class Item ( BaseModel ): name : ... ge : str class User ( BaseModel ): username : str email : str @app . post ( "/items/" , response_model = ResponseMessage , tags = [ "items" ]) async def create_item ( item : Item ): return { "message" : "Item received" } @app . get ( "/items/" , resp ...
https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
ボディ - ネストされたモデル 10451
ボディ - ネストされたモデル FastAPI を使用すると、深くネストされた任意のモデルを定義、検証、文書化、使用することができます(Pydanticのおかげです)。 リストのフィールド 属性をサブタイプとして定義することができます。例えば、Pythonの list は以 ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : list = [] @app . put ( "/items/ {item_id} " ) async def update_item ( item_id : int , item : Item ): results = { "item_i ... = FastAPI () class Item ( BaseModel ): name : str description : str | None = None price : float tax : float | None = None tags : list = [] @app . put ( "/items/ {item_id} " ) async def update_item ( item_id : int , item : Item ): results = { "item_i ... d" : item_id , "item" : item } return results これにより、各項目の型は宣言されていませんが、 tags はある項目のリストになります。 タイプパラメータを持つリストのフィールド しかし、Pythonには型や「タイプパラメータ」を使って ...
https://man.mtool.work/fastapi/0.115/tutorial/body-nested-models/
ボディ - 更新 9677
ボディ - 更新 PUT による置換での更新 項目を更新するには HTTPの PUT 操作を使用することができます。 jsonable_encoder を用いて、入力データをJSON形式で保存できるデータに変換することができます(例:NoSQLデータベース)。例えば、 datetime を str に ... n [ str , None ] = None description : Union [ str , None ] = None price : Union [ float , None ] = None tax : float = 10.5 tags : List [ str ] = [] items = { "foo" : { "name" : "Foo" , "price" : 50.2 }, "bar" : { "name" : "Bar" , "description" : "The ... nders" , "price" : 62 , "tax" : 20.2 }, "baz" : { "name" : "Baz" , "description" : None , "price" : 50.2 , "tax" : 10.5 , "tags" : []}, } @app . get ( "/items/ {item_id} " , response_model = Item ) async def read_item ( item_id : str ): return items ... tem ( BaseModel ): name : str | None = None description : str | None = None price : float | None = None tax : float = 10.5 tags : list [ str ] = [] items = { "foo" : { "name" : "Foo" , "price" : 50.2 }, "bar" : { "name" : "Bar" , "description" : "The ...
https://man.mtool.work/fastapi/0.115/tutorial/body-updates/
メタデータとドキュメントのURL 9466
メタデータとドキュメントのURL FastAPI アプリケーションのいくつかのメタデータの設定をカスタマイズできます。 タイトル、説明文、バージョン 以下を設定できます: タイトル : OpenAPIおよび自動APIドキュメントUIでAPIのタイトル/名前として使用される。 ... me" : "Katana" }] この設定では、自動APIドキュメントは以下の様になります: タグのためのメタデータ さらに、パラメータ openapi_tags を使うと、path operations をグループ分けするための複数のタグに関するメタデータを追加できます。 それぞれのタグ毎にひとつの辞 ... 書を含むリストをとります。 それぞれの辞書は以下をもつことができます: name ( 必須 ): path operations および APIRouter の tags パラメーターで使用するのと同じタグ名である str 。 description : タグの簡単な説明文である str 。 Markdownで記述でき、ドキュ ... の作成 users と items のタグを使った例でメタデータの追加を試してみましょう。 タグのためのメタデータを作成し、それを openapi_tags パラメータに渡します。 Python 3.8+ from fastapi import FastAPI tags_metadata = [ { "name" : "users" , "description" : "Ope ...
https://man.mtool.work/fastapi/0.115/tutorial/metadata/
クエリパラメータモデル 8762
クエリパラメータモデル もし関連する 複数のクエリパラメータ から成るグループがあるなら、それらを宣言するために、 Pydanticモデル を作成できます。 こうすることで、 複数の場所 で そのPydanticモデルを再利用 でき、バリデーションやメタデータを、す ... gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "created_at" , "updated_at" ] = "created_at" tags : list [ str ] = [] @app . get ( "/items/" ) async def read_items ( filter_query : Annotated [ FilterParams , Query ()]): ... gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "created_at" , "updated_at" ] = "created_at" tags : list [ str ] = [] @app . get ( "/items/" ) async def read_items ( filter_query : Annotated [ FilterParams , Query ()]): ... gt = 0 , le = 100 ) offset : int = Field ( 0 , ge = 0 ) order_by : Literal [ "created_at" , "updated_at" ] = "created_at" tags : List [ str ] = [] @app . get ( "/items/" ) async def read_items ( filter_query : Annotated [ FilterParams , Query ()]): ...
https://man.mtool.work/fastapi/0.115/tutorial/query-param-models/
レスポンスモデル 8604
レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : List [ str ] = [] @app . post ( "/items/" , response_model = Item ) async def create_item ( item : Item ) -> Any : retur ... = FastAPI () class Item ( BaseModel ): name : str description : str | None = None price : float tax : float | None = None tags : list [ str ] = [] @app . post ( "/items/" , response_model = Item ) async def create_item ( item : Item ) -> Any : retur ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : list [ str ] = [] @app . post ( "/items/" , response_model = Item ) async def create_item ( item : Item ) -> Any : retur ...
https://man.mtool.work/fastapi/0.115/tutorial/response-model/
General - How To - Recipes 7742
General - How To - Recipes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Here are several pointers to other places in the docs, for general or frequent questions ... that you don't return more data than you should, read the docs for Tutorial - Response Model - Return Type . Documentation Tags - OpenAPI To add tags to your path operations , and group them in the docs UI, read the docs for Tutorial - Path Operation ... Configurations - Tags . Documentation Summary and Description - OpenAPI To add a summary and description to your path operations , and show them ...
https://man.mtool.work/fastapi/0.115/how-to/general/
Path Operationの高度な設定 6879
Path Operationの高度な設定 OpenAPI operationId 注意 あなたがOpenAPIの「エキスパート」でなければ、これは必要ないかもしれません。 path operation で operation_id パラメータを利用することで、OpenAPIの operationId を設定できます。 operation_id は ... Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None tags : Set [ str ] = set () @app . post ( "/items/" , response_model = Item , summary = "Create an item" ) async def create_ite ... - **description**: a long description - **price**: required - **tax**: if the item doesn't have tax, you can omit this - **tags**: a set of unique tag strings for this item \f :param item: User input. """ return item ...
https://man.mtool.work/fastapi/0.115/advanced/path-operation-advanced-configurat...
PREV 1 2 NEXT