Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 299 for flot (0.34 sec)

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

    * Datenkonvertierung
    * Datenvalidierung
    * Automatische Dokumentation
    
    ## Spezielle Typen und Validierungen
    
    Abgesehen von normalen einfachen Typen, wie `str`, `int`, `float`, usw. können Sie komplexere einfache Typen verwenden, die von `str` erben.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  2. tests/test_validate_response.py

    from fastapi.exceptions import ResponseValidationError
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
        return {"name": "invalid", "price": "foo"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2K bytes
    - Viewed (0)
  3. docs/uk/docs/python-types.md

    Python підтримує додаткові "підказки типу" ("type hints") (також звані "анотаціями типу" ("type annotations")).
    
    Ці **"type hints"** є спеціальним синтаксисом, що дозволяє оголошувати <abbr title="наприклад: str, int, float, bool">тип</abbr> змінної.
    
    За допомогою оголошення типів для ваших змінних, редактори та інструменти можуть надати вам кращу підтримку.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/path-params.md

          "url": "https://errors.pydantic.dev/2.1/v/int_parsing"
        }
      ]
    }
    ```
    
    because the path parameter `item_id` had a value of `"foo"`, which is not an `int`.
    
    The same error would appear if you provided a `float` instead of an `int`, as in: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2</a>
    
    !!! check
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  5. docs/ru/docs/tutorial/path-params.md

                "type": "type_error.integer"
            }
        ]
    }
    ```
    
    из-за того, что параметр пути `item_id` имеет значение `"foo"`, которое не является типом  `int`.
    
    Та же ошибка возникнет, если вместо `int` передать `float` , например: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2</a>
    
    !!! check "Заметка"
        **FastAPI** обеспечивает проверку типов, используя всё те же определения типов.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/path-params.md

                ],
                "msg": "value is not a valid integer",
                "type": "type_error.integer"
            }
        ]
    }
    ```
    
    这是因为路径参数 `item_id` 的值 (`"foo"`)的类型不是 `int`。
    
    值的类型不是 `int ` 而是浮点数(`float`)时也会显示同样的错误,比如: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2。</a>
    
    !!! check "检查"
    
        **FastAPI** 使用 Python 类型声明实现了数据校验。
    
        注意,上面的错误清晰地指出了未通过校验的具体原因。
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 01 05:35:40 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  7. tests/test_request_body_parameters_media_type.py

    media_type = "application/vnd.api+json"
    
    
    # NOTE: These are not valid JSON:API resources
    # but they are fine for testing requestBody with custom media_type
    class Product(BaseModel):
        name: str
        price: float
    
    
    class Shop(BaseModel):
        name: str
    
    
    @app.post("/products")
    async def create_product(data: Product = Body(media_type=media_type, embed=True)):
        pass  # pragma: no cover
    
    
    @app.post("/shops")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 6.4K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/response-model.md

    ## 响应模型编码参数
    
    你的响应模型可以具有默认值,例如:
    
    ```Python hl_lines="11  13-14"
    {!../../../docs_src/response_model/tutorial004.py!}
    ```
    
    * `description: Union[str, None] = None` 具有默认值 `None`。
    * `tax: float = 10.5` 具有默认值 `10.5`.
    * `tags: List[str] = []` 具有一个空列表作为默认值: `[]`.
    
    但如果它们并没有存储实际的值,你可能想从结果中忽略它们的默认值。
    
    举个例子,当你在 NoSQL 数据库中保存了具有许多可选属性的模型,但你又不想发送充满默认值的很长的 JSON 响应。
    
    ### 使用 `response_model_exclude_unset` 参数
    
    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)
  9. docs/ja/docs/tutorial/response-model.md

    ## レスポンスモデルのエンコーディングパラメータ
    
    レスポンスモデルにはデフォルト値を設定することができます:
    
    ```Python hl_lines="11 13 14"
    {!../../../docs_src/response_model/tutorial004.py!}
    ```
    
    * `description: str = None`は`None`がデフォルト値です。
    * `tax: float = 10.5`は`10.5`がデフォルト値です。
    * `tags: List[str] = []` は空のリスト(`[]`)がデフォルト値です。
    
    しかし、実際に保存されていない場合には結果からそれらを省略した方が良いかもしれません。
    
    例えば、NoSQLデータベースに多くのオプション属性を持つモデルがあるが、デフォルト値でいっぱいの非常に長いJSONレスポンスを送信したくない場合です。
    
    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)
  10. docs/pl/docs/index.md

    ```Python hl_lines="4  9-12  25-27"
    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 19.4K bytes
    - Viewed (0)
Back to top