Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 850 for pydantic (0.05 sec)

  1. tests/test_inherited_custom_class.py

    import uuid
    
    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    from .utils import needs_pydanticv1, needs_pydanticv2
    
    
    class MyUuid:
        def __init__(self, uuid_string: str):
            self.uuid = uuid_string
    
        def __str__(self):
            return self.uuid
    
        @property  # type: ignore
        def __class__(self):
            return uuid.UUID
    
        @property
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 3K bytes
    - Viewed (0)
  2. fastapi/params.py

    import warnings
    from enum import Enum
    from typing import Any, Callable, Dict, List, Optional, Sequence, Union
    
    from fastapi.openapi.models import Example
    from pydantic.fields import FieldInfo
    from typing_extensions import Annotated, deprecated
    
    from ._compat import PYDANTIC_V2, PYDANTIC_VERSION, Undefined
    
    _Unset: Any = Undefined
    
    
    class ParamTypes(Enum):
        query = "query"
        header = "header"
        path = "path"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 18:06:20 UTC 2024
    - 27.5K bytes
    - Viewed (0)
  3. docs/pt/docs/tutorial/schema-extra-example.md

    Aqui estão várias formas de se fazer isso.
    
    ## `schema_extra` do Pydantic
    
    Você pode declarar um `example` para um modelo Pydantic usando `Config` e `schema_extra`, conforme descrito em <a href="https://docs.pydantic.dev/latest/concepts/json_schema/#schema-customization" class="external-link" target="_blank">Documentação do Pydantic: Schema customization</a>:
    
    ```Python hl_lines="15-23"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  4. docs/ko/docs/tutorial/body-nested-models.md

    ```
    
    /// tip | "팁"
    
    JSON은 오직 `str`형 키만 지원한다는 것을 염두에 두세요.
    
    하지만 Pydantic은 자동 데이터 변환이 있습니다.
    
    즉, API 클라이언트가 문자열을 키로 보내더라도 해당 문자열이 순수한 정수를 포함하는한 Pydantic은 이를 변환하고 검증합니다.
    
    그러므로 `weights`로 받은 `dict`는 실제로 `int` 키와 `float` 값을 가집니다.
    
    ///
    
    ## 요약
    
    **FastAPI**를 사용하면 Pydantic 모델이 제공하는 최대 유연성을 확보하면서 코드를 간단하고 짧게, 그리고 우아하게 유지할 수 있습니다.
    
    물론 아래의 이점도 있습니다:
    
    * 편집기 지원 (자동완성이 어디서나!)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/cookie-param-models.md

    ///
    
    ## Cookies com Modelos Pydantic
    
    Declare o parâmetro de **cookie** que você precisa em um **modelo Pydantic**, e depois declare o parâmetro como um `Cookie`:
    
    //// tab | Python 3.10+
    
    ```Python hl_lines="9-12  16"
    {!> ../../docs_src/cookie_param_models/tutorial001_an_py310.py!}
    ```
    
    ////
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="9-12  16"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 07 20:18:07 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/encoder.md

    👆 💪 ⚙️ `jsonable_encoder` 👈.
    
    ⚫️ 📨 🎚, 💖 Pydantic 🏷, &amp; 📨 🎻 🔗 ⏬:
    
    //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
    
    ```Python hl_lines="5  22"
    {!> ../../docs_src/encoder/tutorial001.py!}
    ```
    
    ////
    
    //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
    
    ```Python hl_lines="4  21"
    {!> ../../docs_src/encoder/tutorial001_py310.py!}
    ```
    
    ////
    
    👉 🖼, ⚫️ 🔜 🗜 Pydantic 🏷 `dict`, &amp; `datetime` `str`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dataclasses/test_tutorial002.py

                        "title": "Item",
                        "required": IsOneOf(
                            ["name", "price", "tags", "description", "tax"],
                            # TODO: remove when deprecating Pydantic v1
                            ["name", "price"],
                        ),
                        "type": "object",
                        "properties": {
                            "name": {"title": "Name", "type": "string"},
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Jul 31 14:09:15 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/header-param-models.md

    If you have a group of related **header parameters**, you can create a **Pydantic model** to declare them.
    
    This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎
    
    /// note
    
    This is supported since FastAPI version `0.115.0`. 🤓
    
    ///
    
    ## Header Parameters with a Pydantic Model
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  9. docs/pt/docs/tutorial/body-updates.md

    ///
    
    ### Usando o parâmetro `exclude_unset` do Pydantic
    
    Se você quiser receber atualizações parciais, é muito útil usar o parâmetro `exclude_unset` no método `.model_dump()` do modelo do Pydantic.
    
    Como `item.model_dump(exclude_unset=True)`.
    
    /// info | Informação
    
    No Pydantic v1, o método que era chamado `.dict()` e foi depreciado (mas ainda suportado) no Pydantic v2. Agora, deve-se usar o método `.model_dump()`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 14 09:16:06 UTC 2024
    - 6K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/body-fields.md

    `Query`や`Path`、`Body`を使って *path operation関数* のパラメータに追加のバリデーションやメタデータを宣言するのと同じように、Pydanticの`Field`を使ってPydanticモデルの内部でバリデーションやメタデータを宣言することができます。
    
    ## `Field`のインポート
    
    まず、以下のようにインポートします:
    
    ```Python hl_lines="4"
    {!../../docs_src/body_fields/tutorial001.py!}
    ```
    
    /// warning | "注意"
    
    `Field`は他の全てのもの(`Query`、`Path`、`Body`など)とは違い、`fastapi`からではなく、`pydantic`から直接インポートされていることに注意してください。
    
    ///
    
    ## モデルの属性の宣言
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.5K bytes
    - Viewed (0)
Back to top