Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 61 for excludes (0.24 sec)

  1. docs/en/docs/tutorial/response-model.md

    !!! info
        You can also use:
    
        * `response_model_exclude_defaults=True`
        * `response_model_exclude_none=True`
    
        as described in <a href="https://docs.pydantic.dev/latest/concepts/serialization/#modeldict" class="external-link" target="_blank">the Pydantic docs</a> for `exclude_defaults` and `exclude_none`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/response-model.md

    !!! info
        你还可以使用:
    
        * `response_model_exclude_defaults=True`
        * `response_model_exclude_none=True`
    
        参考 <a href="https://docs.pydantic.dev/latest/concepts/serialization/#modeldict" class="external-link" target="_blank">Pydantic 文档</a> 中对 `exclude_defaults` 和 `exclude_none` 的描述。
    
    #### 默认值字段有实际值的数据
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.9K bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/response-model.md

    !!! info "情報"
        以下も使用することができます:
    
        * `response_model_exclude_defaults=True`
        * `response_model_exclude_none=True`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/body-updates.md

        `PATCH` 没有 `PUT` 知名,也怎么不常用。
    
        很多人甚至只用 `PUT` 实现部分更新。
    
        **FastAPI** 对此没有任何限制,可以**随意**互换使用这两种操作。
    
        但本指南也会分别介绍这两种操作各自的用途。
    
    ### 使用 Pydantic 的 `exclude_unset` 参数
    
    更新部分数据时,可以在 Pydantic 模型的 `.dict()` 中使用 `exclude_unset` 参数。
    
    比如,`item.dict(exclude_unset=True)`。
    
    这段代码生成的 `dict` 只包含创建 `item` 模型时显式设置的数据,而不包括默认值。
    
    然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`:
    
    ```Python hl_lines="34"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial004.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 633 bytes
    - Viewed (0)
  6. docs_src/response_model/tutorial006.py

        response_model_include=["name", "description"],
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"])
    async def read_item_public_data(item_id: str):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 848 bytes
    - Viewed (0)
  7. docs/en/docs/advanced/dataclasses.md

    {!../../../docs_src/dataclasses/tutorial003.py!}
    ```
    
    1. We still import `field` from standard `dataclasses`.
    
    2. `pydantic.dataclasses` is a drop-in replacement for `dataclasses`.
    
    3. The `Author` dataclass includes a list of `Item` dataclasses.
    
    4. The `Author` dataclass is used as the `response_model` parameter.
    
    5. You can use other standard type annotations with dataclasses as the request body.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/middleware.md

    ```
    
    `app.add_middleware()` receives a middleware class as the first argument and any additional arguments to be passed to the middleware.
    
    ## Integrated middlewares
    
    **FastAPI** includes several middlewares for common use cases, we'll see next how to use them.
    
    !!! note "Technical Details"
        For the next examples, you could also use `from starlette.middleware.something import SomethingMiddleware`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  9. docs/en/docs/deployment/versions.md

    Different versions of **FastAPI** will use a specific newer version of Starlette.
    
    So, you can just let **FastAPI** use the correct Starlette version.
    
    ## About Pydantic
    
    Pydantic includes the tests for **FastAPI** with its own tests, so new versions of Pydantic (above `1.0.0`) are always compatible with FastAPI.
    
    You can pin Pydantic to any version above `1.0.0` that works for you and below `2.0.0`.
    
    For example:
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Nov 05 20:50:37 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/first-steps.md

    This schema definition includes your API paths, the possible parameters they take, etc.
    
    #### Data "schema"
    
    The term "schema" might also refer to the shape of some data, like a JSON content.
    
    In that case, it would mean the JSON attributes, and data types they have, etc.
    
    #### OpenAPI and JSON Schema
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 12K bytes
    - Viewed (0)
Back to top