- Sort Score
- Num 10 results
- Language All
Results 71 - 80 of 844 for pydantic (0.18 seconds)
-
docs/en/docs/tutorial/body-nested-models.md
To see all the options you have, checkout [Pydantic's Type Overview](https://docs.pydantic.dev/latest/concepts/types/). You will see some examples in the next chapter. For example, as in the `Image` model we have a `url` field, we can declare it to be an instance of Pydantic's `HttpUrl` instead of a `str`: {* ../../docs_src/body_nested_models/tutorial005_py310.py hl[2,8] *}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 6.6K bytes - Click Count (0) -
docs/zh/docs/advanced/json-base64-bytes.md
``` /// tip | 提示 `aGVsbG8=` 是 `hello` 的 base64 编码。 /// 随后 Pydantic 会解码该 base64 字符串,并在模型的 `data` 字段中提供原始字节。 你将会收到类似的响应: ```json { "description": "Some data", "content": "hello" } ``` ## 用于输出数据的 Pydantic `bytes` { #pydantic-bytes-for-output-data } 对于输出数据,你也可以在模型配置中为 `bytes` 字段使用 `ser_json_bytes`,Pydantic 会在生成 JSON 响应时将字节以 base64 进行序列化。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:29:48 GMT 2026 - 2.4K bytes - Click Count (0) -
docs/ko/docs/tutorial/body-nested-models.md
`str`, `int`, `float` 등과 같은 일반적인 단일 타입과는 별개로, `str`을 상속하는 더 복잡한 단일 타입을 사용할 수 있습니다. 사용할 수 있는 모든 옵션을 보려면 [Pydantic의 Type Overview](https://docs.pydantic.dev/latest/concepts/types/)를 확인하세요. 다음 장에서 몇 가지 예제를 볼 수 있습니다. 예를 들어 `Image` 모델에는 `url` 필드가 있으므로, 이를 `str` 대신 Pydantic의 `HttpUrl` 인스턴스로 선언할 수 있습니다: {* ../../docs_src/body_nested_models/tutorial005_py310.py hl[2,8] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 7.7K bytes - Click Count (0) -
tests/test_inherited_custom_class.py
import uuid import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel 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 def __dict__(self):Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 1.8K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/header-param-models.md
如果你有一組相關的標頭參數,可以建立一個 Pydantic 模型來宣告它們。 這能讓你在多處重複使用該模型,並一次性為所有參數宣告驗證與中繼資料。😎 /// note | 注意 自 FastAPI 版本 `0.115.0` 起支援。🤓 /// ## 以 Pydantic 模型宣告標頭參數 { #header-parameters-with-a-pydantic-model } 在 Pydantic 模型中宣告你需要的標頭參數,然後將參數宣告為 `Header`: {* ../../docs_src/header_param_models/tutorial001_an_py310.py hl[9:14,18] *} FastAPI 會從請求的標頭為每個欄位擷取資料,並交給你已定義的 Pydantic 模型實例。 ## 檢視文件 { #check-the-docs }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 14 08:15:26 GMT 2026 - 2.3K bytes - Click Count (0) -
docs/zh/docs/tutorial/body-updates.md
/// note | 注意 `PATCH` 没有 `PUT` 知名,也没那么常用。 很多团队甚至只用 `PUT` 实现部分更新。 你可以**随意**选择如何使用它们,**FastAPI** 不做任何限制。 但本指南会大致展示它们的预期用法。 /// ### 使用 Pydantic 的 `exclude_unset` 参数 { #using-pydantics-exclude-unset-parameter } 如果要接收部分更新,建议在 Pydantic 模型的 `.model_dump()` 中使用 `exclude_unset` 参数。 比如,`item.model_dump(exclude_unset=True)`。 这会生成一个 `dict`,只包含创建 `item` 模型时显式设置的数据,不包含默认值。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 3.7K bytes - Click Count (0) -
docs/zh/docs/tutorial/body-fields.md
# 请求体 - 字段 { #body-fields } 与在*路径操作函数*中使用 `Query`、`Path` 、`Body` 声明校验与元数据的方式一样,可以使用 Pydantic 的 `Field` 在 Pydantic 模型内部声明校验和元数据。 ## 导入 `Field` { #import-field } 首先,从 Pydantic 中导入 `Field`: {* ../../docs_src/body_fields/tutorial001_an_py310.py hl[4] *} /// warning | 警告 注意,与从 `fastapi` 导入 `Query`,`Path`、`Body` 不同,要直接从 `pydantic` 导入 `Field` 。 /// ## 声明模型属性 { #declare-model-attributes } 然后,使用 `Field` 定义模型的属性:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:39:41 GMT 2026 - 2.1K bytes - Click Count (0) -
docs/ja/docs/tutorial/schema-extra-example.md
アプリが受け取れるデータの例を宣言できます。 ここでは、それを行ういくつかの方法を紹介します。 ## Pydanticモデルでの追加JSON Schemaデータ { #extra-json-schema-data-in-pydantic-models } 生成されるJSON Schemaに追加されるPydanticモデルの`examples`を宣言できます。 {* ../../docs_src/schema_extra_example/tutorial001_py310.py hl[13:24] *} その追加情報は、そのモデルの出力**JSON Schema**にそのまま追加され、APIドキュメントで使用されます。 [Pydanticのドキュメント: Configuration](https://docs.pydantic.dev/latest/api/config/)で説明されているように、`dict`を受け取る属性`model_config`を使用できます。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 10.5K bytes - Click Count (0) -
docs/ko/docs/tutorial/cookie-param-models.md
관련있는 **쿠키**들의 그룹이 있는 경우, **Pydantic 모델**을 생성하여 선언할 수 있습니다. 🍪 이를 통해 **여러 위치**에서 **모델을 재사용** 할 수 있고 모든 매개변수에 대한 유효성 검사 및 메타데이터를 한 번에 선언할 수도 있습니다. 😎 /// note | 참고 이 기능은 FastAPI 버전 `0.115.0` 이후부터 지원됩니다. 🤓 /// /// tip | 팁 동일한 기술이 `Query`, `Cookie`, 그리고 `Header`에 적용됩니다. 😎 /// ## Pydantic 모델을 사용한 쿠키 { #cookies-with-a-pydantic-model }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 14 08:57:01 GMT 2026 - 3.6K bytes - Click Count (0) -
docs/en/docs/tutorial/extra-data-types.md
* `Decimal`: * Standard Python `Decimal`. * In requests and responses, handled the same as a `float`. * You can check all the valid Pydantic data types here: [Pydantic data types](https://docs.pydantic.dev/latest/usage/types/types/). ## Example { #example } Here's an example *path operation* with parameters using some of the above types.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 2.6K bytes - Click Count (0)