Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for field_info (0.5 sec)

  1. fastapi/_compat/v2.py

    # TODO: remove when dropping support for Pydantic < v2.12.3
    def asdict(field_info: FieldInfo) -> dict[str, Any]:
        attributes = {}
        for attr in _Attrs:
            value = getattr(field_info, attr, Undefined)
            if value is not Undefined:
                attributes[attr] = value
        return {
            "annotation": field_info.annotation,
            "metadata": field_info.metadata,
            "attributes": attributes,
        }
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  2. tests/test_compat.py

    from pydantic import BaseModel, ConfigDict
    from pydantic.fields import FieldInfo
    
    from .utils import needs_py310
    
    
    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():
        app = FastAPI()
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  3. fastapi/dependencies/utils.py

                field_info = params.Body(annotation=use_annotation, default=default_value)
            else:
                field_info = params.Query(annotation=use_annotation, default=default_value)
    
        field = None
        # It's a field_info, not a dependency
        if field_info is not None:
            # Handle field_info.in_
            if is_path_param:
                assert isinstance(field_info, params.Path), (
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 37.6K bytes
    - Viewed (3)
  4. fastapi/openapi/utils.py

                default_convert_underscores = getattr(
                    first_field.field_info, "convert_underscores", True
                )
        for param_type, param_group in parameter_groups:
            for param in param_group:
                field_info = param.field_info
                # field_info = cast(Param, field_info)
                if not getattr(field_info, "include_in_schema", True):
                    continue
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 23.2K bytes
    - Viewed (0)
  5. fastapi/utils.py

                f" Please update the response model {type_!r}."
            )
        class_validators = class_validators or {}
    
        field_info = field_info or FieldInfo(annotation=type_, default=default, alias=alias)
        kwargs = {"mode": mode, "name": name, "field_info": field_info}
        try:
            return v2.ModelField(**kwargs)  # type: ignore[return-value,arg-type]
        except PydanticSchemaGenerationError:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  6. fastapi/routing.py

        assert dependant.call is not None, "dependant.call must be a function"
        is_coroutine = dependant.is_coroutine_callable
        is_body_form = body_field and isinstance(body_field.field_info, params.Form)
        if isinstance(response_class, DefaultPlaceholder):
            actual_response_class: type[Response] = response_class.value
        else:
            actual_response_class = response_class
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 174.6K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/body-fields.md

    И `Field` (из Pydantic) также возвращает экземпляр `FieldInfo`.
    
    `Body` также напрямую возвращает объекты подкласса `FieldInfo`. И есть и другие, с которыми вы познакомитесь позже, которые являются подклассами класса `Body`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Sep 30 11:24:39 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/body-fields.md

    `Field` 的工作方式和 `Query`、`Path`、`Body` 相同,参数也相同。
    
    /// note | 技术细节
    
    实际上,`Query`、`Path` 都是 `Params` 的子类,而 `Params` 类又是 Pydantic 中 `FieldInfo` 的子类。
    
    Pydantic 的 `Field` 返回也是 `FieldInfo` 的类实例。
    
    `Body` 直接返回的也是 `FieldInfo` 的子类的对象。后文还会介绍一些 `Body` 的子类。
    
    注意,从 `fastapi` 导入的 `Query`、`Path` 等对象实际上都是返回特殊类的函数。
    
    ///
    
    /// tip | 提示
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  9. 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.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 2.3K bytes
    - Viewed (0)
  10. docs/uk/docs/tutorial/body-fields.md

    Насправді, `Query`, `Path` та інші, що ви побачите далі, створюють об'єкти підкласів загального класу `Param`, котрий сам є підкласом класу `FieldInfo` з Pydantic.
    
    І `Field` від Pydantic також повертає екземпляр `FieldInfo`.
    
    `Body` також безпосередньо повертає об'єкти підкласу `FieldInfo`. І є інші підкласи, які ви побачите пізніше, що є підкласами класу Body.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.7K bytes
    - Viewed (0)
Back to top