Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 710 for body (0.16 sec)

  1. docs/ja/docs/tutorial/body-nested-models.md

    ```Python hl_lines="12"
    {!../../../docs_src/body_nested_models/tutorial001.py!}
    ```
    
    これにより、各項目の型は宣言されていませんが、`tags`はある項目のリストになります。
    
    ## タイプパラメータを持つリストのフィールド
    
    しかし、Pythonには型や「タイプパラメータ」を使ってリストを宣言する方法があります:
    
    ### typingの`List`をインポート
    
    まず、Pythonの標準の`typing`モジュールから`List`をインポートします:
    
    ```Python hl_lines="1"
    {!../../../docs_src/body_nested_models/tutorial002.py!}
    ```
    
    ### タイプパラメータを持つ`List`の宣言
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/body-multiple-params.md

    ## Embed a single body parameter
    
    Let's say you only have a single `item` body parameter from a Pydantic model `Item`.
    
    By default, **FastAPI** will then expect its body directly.
    
    But if you want it to expect a JSON with a key `item` and inside of it the model contents, as it does when you declare extra body parameters, you can use the special `Body` parameter `embed`:
    
    ```Python
    item: Item = Body(embed=True)
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 7.7K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/body-multiple-params.md

    ```Python
    item: Item = Body(embed=True)
    ```
    
    :
    
    === "🐍 3️⃣.6️⃣ & 🔛"
    
        ```Python hl_lines="17"
        {!> ../../../docs_src/body_multiple_params/tutorial005.py!}
        ```
    
    === "🐍 3️⃣.1️⃣0️⃣ & 🔛"
    
        ```Python hl_lines="15"
        {!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
        ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 5K bytes
    - Viewed (0)
  4. docs/ja/docs/tutorial/body-multiple-params.md

    ## ボディ内の単数値
    
    クエリとパスパラメータの追加データを定義するための `Query` と `Path` があるのと同じように、 **FastAPI** は同等の `Body` を提供します。
    
    例えば、前のモデルを拡張して、同じボディに `item` と `user` の他にもう一つのキー `importance` を入れたいと決めることができます。
    
    単数値なのでそのまま宣言すると、**FastAPI** はそれがクエリパラメータであるとみなします。
    
    しかし、`Body`を使用して、**FastAPI** に別のボディキーとして扱うように指示することができます:
    
    
    ```Python hl_lines="23"
    {!../../../docs_src/body_multiple_params/tutorial003.py!}
    ```
    
    この場合、**FastAPI** は以下のようなボディを期待します:
    
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 15 15:48:41 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/body-multiple-params.md

    ```Python
    item: Item = Body(embed=True)
    ```
    
    como em:
    
    === "Python 3.10+"
    
        ```Python hl_lines="15"
        {!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="17"
        {!> ../../../docs_src/body_multiple_params/tutorial005.py!}
        ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6K bytes
    - Viewed (0)
  6. docs/pt/docs/tutorial/body-nested-models.md

    ### Defina um sub-modelo
    
    Por exemplo, nós podemos definir um modelo `Image`:
    
    ```Python hl_lines="9-11"
    {!../../../docs_src/body_nested_models/tutorial004.py!}
    ```
    
    ### Use o sub-modelo como um tipo
    
    E então podemos usa-lo como o tipo de um atributo:
    
    ```Python hl_lines="20"
    {!../../../docs_src/body_nested_models/tutorial004.py!}
    ```
    
    Isso significa que o **FastAPI** vai esperar um corpo similar à:
    
    ```JSON
    {
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.4K bytes
    - Viewed (0)
  7. tests/test_union_body.py

                                        }
                                    }
                                },
                            },
                        },
                        "summary": "Save Union Body",
                        "operationId": "save_union_body_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.6K bytes
    - Viewed (0)
  8. tests/test_multi_body_errors.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: List[Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_put_correct_body():
        response = client.post("/items/", json=[{"name": "Foo", "age": 5}])
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  9. tests/test_regex_deprecated_body.py

                                                {
                                                    "$ref": "#/components/schemas/Body_read_items_items__post"
                                                }
                                            ],
                                            "title": "Body",
                                        }
                                    )
                                    | IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  10. tests/test_get_request_body.py

    @app.get("/product")
    async def create_item(product: Product):
        return product
    
    
    client = TestClient(app)
    
    
    def test_get_with_body():
        body = {"name": "Foo", "description": "Some description", "price": 5.5}
        response = client.request("GET", "/product", json=body)
        assert response.json() == body
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.7K bytes
    - Viewed (0)
Back to top