Browse Source

change _Unset to be Default(None) for type checking reasons

pull/15091/head
svlandeg 4 months ago
parent
commit
11a0f1bf3c
  1. 5
      fastapi/datastructures.py
  2. 7
      fastapi/openapi/utils.py
  3. 101
      fastapi/param_functions.py
  4. 115
      fastapi/params.py

5
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)

7
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

101
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(

115
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,

Loading…
Cancel
Save