- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 18 for FieldInfo (0.05 seconds)
-
docs/zh-hant/docs/tutorial/body-fields.md
`Field` 的用法與 `Query`、`Path`、`Body` 相同,擁有相同的參數等。 /// note | 技術細節 實際上,你接下來會看到的 `Query`、`Path` 等,會建立共同父類別 `Param` 的子類別物件,而 `Param` 本身是 Pydantic 的 `FieldInfo` 類別的子類別。 而 Pydantic 的 `Field` 也會回傳一個 `FieldInfo` 的實例。 `Body` 也會直接回傳 `FieldInfo` 子類別的物件。稍後你會看到還有其他類別是 `Body` 類別的子類別。 記得,當你從 `fastapi` 匯入 `Query`、`Path` 等時,它們其實是回傳特殊類別的函式。 /// /// tip
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/en/docs/tutorial/body-fields.md
Actually, `Query`, `Path` and others you'll see next create objects of subclasses of a common `Param` class, which is itself a subclass of Pydantic's `FieldInfo` class. And Pydantic's `Field` returns an instance of `FieldInfo` as well. `Body` also returns objects of a subclass of `FieldInfo` directly. And there are others you will see later that are subclasses of the `Body` class.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Aug 31 09:15:41 GMT 2025 - 2.3K bytes - Click Count (0) -
tests/test_compat.py
from fastapi.testclient import TestClient from pydantic import BaseModel, ConfigDict from pydantic.fields import FieldInfo def test_model_field_default_required(): from fastapi._compat import v2 # For coverage field_info = FieldInfo(annotation=str) field = v2.ModelField(name="foo", field_info=field_info) assert field.default is Undefined def test_complex():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 4.2K bytes - Click Count (0) -
fastapi/_compat/v2.py
GetJsonSchemaHandler as GetJsonSchemaHandler, ) from pydantic._internal._typing_extra import eval_type_lenient # ty: ignore[deprecated] from pydantic.fields import FieldInfo as FieldInfo from pydantic.json_schema import GenerateJsonSchema as _GenerateJsonSchema from pydantic.json_schema import JsonSchemaValue as JsonSchemaValue from pydantic_core import CoreSchema as CoreSchema
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 16.7K bytes - Click Count (0) -
docs/zh/docs/tutorial/body-fields.md
`Field` 的工作方式和 `Query`、`Path`、`Body` 相同,参数也相同。 /// note | 技术细节 实际上,`Query`、`Path` 以及你接下来会看到的其它对象,会创建公共 `Param` 类的子类的对象,而 `Param` 本身是 Pydantic 中 `FieldInfo` 的子类。 Pydantic 的 `Field` 返回也是 `FieldInfo` 的类实例。 `Body` 直接返回的也是 `FieldInfo` 的子类的对象。后文还会介绍一些 `Body` 的子类。 注意,从 `fastapi` 导入的 `Query`、`Path` 等对象实际上都是返回特殊类的函数。 /// /// tip | 提示
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) -
fastapi/utils.py
annotation_is_pydantic_v1, ) from fastapi.datastructures import DefaultPlaceholder, DefaultType from fastapi.exceptions import FastAPIDeprecationWarning, PydanticV1NotSupportedError from pydantic.fields import FieldInfo from ._compat import v2 if TYPE_CHECKING: # pragma: nocover from .routing import APIRoute def is_body_allowed_for_status_code(status_code: int | str | None) -> bool: if status_code is None:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 11 18:41:21 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/ja/docs/tutorial/body-fields.md
`Field`は`Query`や`Path`、`Body`と同じように動作し、全く同様のパラメータなどを持ちます。 /// note | 技術詳細 実際には次に見る`Query`や`Path`などは、共通の`Param`クラスのサブクラスのオブジェクトを作成しますが、それ自体はPydanticの`FieldInfo`クラスのサブクラスです。 また、Pydanticの`Field`は`FieldInfo`のインスタンスも返します。 `Body`は`FieldInfo`のサブクラスのオブジェクトを直接返すこともできます。そして、他にも`Body`クラスのサブクラスであるものがあります。 `fastapi`から`Query`や`Path`などをインポートする場合、これらは実際には特殊なクラスを返す関数であることに注意してください。 /// /// tip | 豆知識
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 16:44:21 GMT 2026 - 3K bytes - Click Count (0) -
fastapi/dependencies/utils.py
] if fastapi_specific_annotations: fastapi_annotation: FieldInfo | params.Depends | None = ( fastapi_specific_annotations[-1] ) else: fastapi_annotation = None # Set default for Annotated FieldInfo if isinstance(fastapi_annotation, FieldInfo): # Copy `field_info` because we mutate `field_info.default` below.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 38.7K bytes - Click Count (3) -
fastapi/params.py
from pydantic import AliasChoices, AliasPath from pydantic.fields import FieldInfo from typing_extensions import deprecated from ._compat import ( Undefined, ) from .datastructures import _Unset class ParamTypes(Enum): query = "query" header = "header" path = "path" cookie = "cookie" class Param(FieldInfo): # type: ignore[misc] in_: ParamTypes def __init__(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 25.7K bytes - Click Count (0) -
fastapi/datastructures.py
if the overridden default value was truthy. """ return DefaultPlaceholder(value) # type: ignore # Sentinel for "parameter not provided" in Param/FieldInfo. # Typed as None to satisfy tyCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 5.2K bytes - Click Count (0)