From 11a0f1bf3cd3c7c5b4c0e401347481676111e2cc Mon Sep 17 00:00:00 2001 From: svlandeg Date: Fri, 13 Mar 2026 16:25:23 +0100 Subject: [PATCH] change _Unset to be Default(None) for type checking reasons --- fastapi/datastructures.py | 5 ++ fastapi/openapi/utils.py | 7 +-- fastapi/param_functions.py | 101 ++++++++++++++++---------------- fastapi/params.py | 115 ++++++++++++++++++------------------- 4 files changed, 115 insertions(+), 113 deletions(-) diff --git a/fastapi/datastructures.py b/fastapi/datastructures.py index 479e1a7c3b..1da784cf09 100644 --- a/fastapi/datastructures.py +++ b/fastapi/datastructures.py @@ -179,3 +179,8 @@ def Default(value: DefaultType) -> DefaultType: 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 ty +_Unset = Default(None) diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py index 298c04c7fe..8f1852b0cc 100644 --- a/fastapi/openapi/utils.py +++ b/fastapi/openapi/utils.py @@ -8,14 +8,13 @@ from typing import Any, Literal, cast from fastapi import routing from fastapi._compat import ( ModelField, - Undefined, get_definitions, get_flat_models_from_fields, get_model_name_map, get_schema_from_model_field, lenient_issubclass, ) -from fastapi.datastructures import DefaultPlaceholder +from fastapi.datastructures import DefaultPlaceholder, _Unset from fastapi.dependencies.models import Dependant from fastapi.dependencies.utils import ( _get_flat_fields_from_params, @@ -170,7 +169,7 @@ def _get_openapi_operation_parameters( example = getattr(field_info, "example", None) if openapi_examples: parameter["examples"] = jsonable_encoder(openapi_examples) - elif example != Undefined: + elif example is not _Unset: parameter["example"] = jsonable_encoder(example) if getattr(field_info, "deprecated", None): parameter["deprecated"] = True @@ -207,7 +206,7 @@ def get_openapi_operation_request_body( request_media_content["examples"] = jsonable_encoder( field_info.openapi_examples ) - elif field_info.example != Undefined: + elif field_info.example is not _Unset: request_media_content["example"] = jsonable_encoder(field_info.example) request_body_oai["content"] = {request_media_type: request_media_content} return request_body_oai diff --git a/fastapi/param_functions.py b/fastapi/param_functions.py index 1e7237fac9..1856178fcb 100644 --- a/fastapi/param_functions.py +++ b/fastapi/param_functions.py @@ -4,12 +4,11 @@ from typing import Annotated, Any, Literal from annotated_doc import Doc from fastapi import params from fastapi._compat import Undefined +from fastapi.datastructures import _Unset from fastapi.openapi.models import Example from pydantic import AliasChoices, AliasPath from typing_extensions import deprecated -_Unset: Any = Undefined - def Path( # noqa: N802 default: Annotated[ @@ -34,7 +33,7 @@ def Path( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, alias: Annotated[ str | None, Doc( @@ -54,7 +53,7 @@ def Path( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -190,7 +189,7 @@ def Path( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -198,7 +197,7 @@ def Path( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -206,7 +205,7 @@ def Path( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -214,7 +213,7 @@ def Path( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -222,7 +221,7 @@ def Path( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -378,7 +377,7 @@ def Query( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, alias: Annotated[ str | None, Doc( @@ -401,7 +400,7 @@ def Query( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -549,7 +548,7 @@ def Query( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -557,7 +556,7 @@ def Query( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -565,7 +564,7 @@ def Query( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -573,7 +572,7 @@ def Query( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -581,7 +580,7 @@ def Query( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -719,7 +718,7 @@ def Header( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, alias: Annotated[ str | None, Doc( @@ -739,7 +738,7 @@ def Header( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -871,7 +870,7 @@ def Header( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -879,7 +878,7 @@ def Header( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -887,7 +886,7 @@ def Header( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -895,7 +894,7 @@ def Header( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -903,7 +902,7 @@ def Header( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -1036,7 +1035,7 @@ def Cookie( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, alias: Annotated[ str | None, Doc( @@ -1056,7 +1055,7 @@ def Cookie( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -1177,7 +1176,7 @@ def Cookie( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -1185,7 +1184,7 @@ def Cookie( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -1193,7 +1192,7 @@ def Cookie( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -1201,7 +1200,7 @@ def Cookie( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -1209,7 +1208,7 @@ def Cookie( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -1341,7 +1340,7 @@ def Body( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, embed: Annotated[ bool | None, Doc( @@ -1384,7 +1383,7 @@ def Body( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -1505,7 +1504,7 @@ def Body( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -1513,7 +1512,7 @@ def Body( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -1521,7 +1520,7 @@ def Body( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -1529,7 +1528,7 @@ def Body( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -1537,7 +1536,7 @@ def Body( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -1671,7 +1670,7 @@ def Form( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, media_type: Annotated[ str, Doc( @@ -1700,7 +1699,7 @@ def Form( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -1821,7 +1820,7 @@ def Form( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -1829,7 +1828,7 @@ def Form( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -1837,7 +1836,7 @@ def Form( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -1845,7 +1844,7 @@ def Form( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -1853,7 +1852,7 @@ def Form( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( @@ -1986,7 +1985,7 @@ def File( # noqa: N802 The parameter is available only for compatibility. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, media_type: Annotated[ str, Doc( @@ -2015,7 +2014,7 @@ def File( # noqa: N802 Priority of the alias. This affects whether an alias generator is used. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, validation_alias: Annotated[ str | AliasPath | AliasChoices | None, Doc( @@ -2136,7 +2135,7 @@ def File( # noqa: N802 If `True`, strict validation is applied to the field. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, multiple_of: Annotated[ float | None, Doc( @@ -2144,7 +2143,7 @@ def File( # noqa: N802 Value must be a multiple of this. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, allow_inf_nan: Annotated[ bool | None, Doc( @@ -2152,7 +2151,7 @@ def File( # noqa: N802 Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, max_digits: Annotated[ int | None, Doc( @@ -2160,7 +2159,7 @@ def File( # noqa: N802 Maximum number of digits allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, decimal_places: Annotated[ int | None, Doc( @@ -2168,7 +2167,7 @@ def File( # noqa: N802 Maximum number of decimal places allowed for decimal values. """ ), - ] = _Unset, # ty: ignore[invalid-parameter-default] + ] = _Unset, examples: Annotated[ list[Any] | None, Doc( diff --git a/fastapi/params.py b/fastapi/params.py index ec4dc15115..e8f2eb290d 100644 --- a/fastapi/params.py +++ b/fastapi/params.py @@ -13,8 +13,7 @@ from typing_extensions import deprecated from ._compat import ( Undefined, ) - -_Unset: Any = Undefined +from .datastructures import _Unset class ParamTypes(Enum): @@ -31,10 +30,10 @@ class Param(FieldInfo): # type: ignore[misc] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -53,11 +52,11 @@ class Param(FieldInfo): # type: ignore[misc] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -142,10 +141,10 @@ class Path(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = ..., *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -164,11 +163,11 @@ class Path(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -226,10 +225,10 @@ class Query(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -248,11 +247,11 @@ class Query(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -308,10 +307,10 @@ class Header(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, convert_underscores: bool = True, @@ -331,11 +330,11 @@ class Header(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -392,10 +391,10 @@ class Cookie(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -414,11 +413,11 @@ class Cookie(Param): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -472,12 +471,12 @@ class Body(FieldInfo): # type: ignore[misc] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, embed: bool | None = None, media_type: str = "application/json", alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -496,11 +495,11 @@ class Body(FieldInfo): # type: ignore[misc] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -584,11 +583,11 @@ class Form(Body): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, media_type: str = "application/x-www-form-urlencoded", alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -607,11 +606,11 @@ class Form(Body): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None, @@ -666,11 +665,11 @@ class File(Form): # type: ignore[misc] # ty: ignore[unused-ignore-comment] self, default: Any = Undefined, *, - default_factory: Callable[[], Any] | None = _Unset, # ty: ignore[invalid-parameter-default] + default_factory: Callable[[], Any] | None = _Unset, annotation: Any | None = None, media_type: str = "multipart/form-data", alias: str | None = None, - alias_priority: int | None = _Unset, # ty: ignore[invalid-parameter-default] + alias_priority: int | None = _Unset, validation_alias: str | AliasPath | AliasChoices | None = None, serialization_alias: str | None = None, title: str | None = None, @@ -689,11 +688,11 @@ class File(Form): # type: ignore[misc] # ty: ignore[unused-ignore-comment] ), ] = None, discriminator: str | None = None, - strict: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - multiple_of: float | None = _Unset, # ty: ignore[invalid-parameter-default] - allow_inf_nan: bool | None = _Unset, # ty: ignore[invalid-parameter-default] - max_digits: int | None = _Unset, # ty: ignore[invalid-parameter-default] - decimal_places: int | None = _Unset, # ty: ignore[invalid-parameter-default] + strict: bool | None = _Unset, + multiple_of: float | None = _Unset, + allow_inf_nan: bool | None = _Unset, + max_digits: int | None = _Unset, + decimal_places: int | None = _Unset, examples: list[Any] | None = None, example: Annotated[ Any | None,