Aquí está la información de referencia para los parámetros de petición.
Estas son las funciones especiales que puedes poner en los parámetros de la función de path operation o en funciones de dependencia con Annotated para obtener datos de la petición.
Incluye:
Query()
Path()
Body()
Cookie()
Header()
Form()
File()
Puedes importarlas todas directamente desde fastapi:
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:Callable[[], Any] | NoneDEFAULT:_Unset
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
Lee más sobre esto en la
[documentación de FastAPI sobre parámetros Query](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#add-regular-expressions
TYPE:str | NoneDEFAULT:None
regex
Obsoleto en FastAPI 0.100.0 y Pydantic v2, usa pattern en su lugar. Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
discriminator
Nombre del campo del parámetro para discriminar el tipo en una unión etiquetada.
TYPE:str | NoneDEFAULT:None
strict
Si es True, se aplica validación estricta al campo.
TYPE:bool | NoneDEFAULT:_Unset
multiple_of
El valor debe ser múltiplo de esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:_Unset
allow_inf_nan
Permite inf, -inf, nan. Solo aplicable a números.
TYPE:bool | NoneDEFAULT:_Unset
max_digits
Número máximo de dígitos permitidos para valores decimales.
TYPE:int | NoneDEFAULT:_Unset
decimal_places
Número máximo de decimales permitidos para valores decimales.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Para incluir (o no) este campo de parámetro en el OpenAPI generado.
Probablemente no lo necesites, pero está disponible.
Esto afecta al OpenAPI generado (ej. visible en /docs).
Lee más sobre esto en la
[documentación de FastAPI sobre parámetros Query](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defQuery(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#alternative-old-query-as-the-default-value) """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#alias-parameters) """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#declare-more-metadata) """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#declare-more-metadata) """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/) """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/) """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#add-regular-expressions """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#deprecating-parameters) """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). Read more about it in the [FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.Query(default=default,default_factory=default_factory,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
fromtypingimportAnnotatedfromfastapiimportFastAPI,Pathapp=FastAPI()@app.get("/items/{item_id}")asyncdefread_items(item_id:Annotated[int,Path(title="The ID of the item to get")],):return{"item_id":item_id}
PARÁMETRO
DESCRIPCIÓN
default
Valor por defecto si el campo del parámetro no está establecido.
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:AnyDEFAULT:...
default_factory
Un callable para generar el valor por defecto.
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:Callable[[], Any] | NoneDEFAULT:_Unset
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defPath(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=...,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. Read more about it in the [FastAPI docs for Path Parameters and Numeric Validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#declare-metadata) """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. Read more about it in the [FastAPI docs about Path parameters numeric validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#number-validations-greater-than-and-less-than-or-equal) """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:""" Declare a path parameter for a *path operation*. Read more about it in the [FastAPI docs for Path Parameters and Numeric Validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/). ```python from typing import Annotated from fastapi import FastAPI, Path app = FastAPI() @app.get("/items/{item_id}") async def read_items( item_id: Annotated[int, Path(title="The ID of the item to get")], ): return {"item_id": item_id} ``` """returnparams.Path(default=default,default_factory=default_factory,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
El tipo de media de este campo de parámetro. Cambiarlo afectaría al
OpenAPI generado, pero actualmente no afecta al parsing de los datos.
TYPE:strDEFAULT:'application/json'
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
TYPE:str | NoneDEFAULT:None
title
Título legible por humanos.
TYPE:str | NoneDEFAULT:None
description
Descripción legible por humanos.
TYPE:str | NoneDEFAULT:None
gt
Mayor que. Si se establece, el valor debe ser mayor que esto. Solo aplicable a
números.
TYPE:float | NoneDEFAULT:None
ge
Mayor o igual que. Si se establece, el valor debe ser mayor o igual que
esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
lt
Menor que. Si se establece, el valor debe ser menor que esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
le
Menor o igual que. Si se establece, el valor debe ser menor o igual que esto.
Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
min_length
Longitud mínima para cadenas.
TYPE:int | NoneDEFAULT:None
max_length
Longitud máxima para cadenas.
TYPE:int | NoneDEFAULT:None
pattern
Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
regex
Obsoleto en FastAPI 0.100.0 y Pydantic v2, usa pattern en su lugar. Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
discriminator
Nombre del campo del parámetro para discriminar el tipo en una unión etiquetada.
TYPE:str | NoneDEFAULT:None
strict
Si es True, se aplica validación estricta al campo.
TYPE:bool | NoneDEFAULT:_Unset
multiple_of
El valor debe ser múltiplo de esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:_Unset
allow_inf_nan
Permite inf, -inf, nan. Solo aplicable a números.
TYPE:bool | NoneDEFAULT:_Unset
max_digits
Número máximo de dígitos permitidos para valores decimales.
TYPE:int | NoneDEFAULT:_Unset
decimal_places
Número máximo de decimales permitidos para valores decimales.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defBody(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,embed:Annotated[bool|None,Doc(""" When `embed` is `True`, the parameter will be expected in a JSON body as a key instead of being the JSON body itself. This happens automatically when more than one `Body` parameter is declared. Read more about it in the [FastAPI docs for Body - Multiple Parameters](https://fastapi.tiangolo.com/tutorial/body-multiple-params/#embed-a-single-body-parameter). """),]=None,media_type:Annotated[str,Doc(""" The media type of this parameter field. Changing it would affect the generated OpenAPI, but currently it doesn't affect the parsing of the data. """),]="application/json",alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.Body(default=default,default_factory=default_factory,embed=embed,media_type=media_type,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
Valor por defecto si el campo del parámetro no está establecido.
TYPE:AnyDEFAULT:Undefined
default_factory
Un callable para generar el valor por defecto.
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:Callable[[], Any] | NoneDEFAULT:_Unset
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
TYPE:str | NoneDEFAULT:None
title
Título legible por humanos.
TYPE:str | NoneDEFAULT:None
description
Descripción legible por humanos.
TYPE:str | NoneDEFAULT:None
gt
Mayor que. Si se establece, el valor debe ser mayor que esto. Solo aplicable a
números.
TYPE:float | NoneDEFAULT:None
ge
Mayor o igual que. Si se establece, el valor debe ser mayor o igual que
esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
lt
Menor que. Si se establece, el valor debe ser menor que esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
le
Menor o igual que. Si se establece, el valor debe ser menor o igual que esto.
Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
min_length
Longitud mínima para cadenas.
TYPE:int | NoneDEFAULT:None
max_length
Longitud máxima para cadenas.
TYPE:int | NoneDEFAULT:None
pattern
Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
regex
Obsoleto en FastAPI 0.100.0 y Pydantic v2, usa pattern en su lugar. Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
discriminator
Nombre del campo del parámetro para discriminar el tipo en una unión etiquetada.
TYPE:str | NoneDEFAULT:None
strict
Si es True, se aplica validación estricta al campo.
TYPE:bool | NoneDEFAULT:_Unset
multiple_of
El valor debe ser múltiplo de esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:_Unset
allow_inf_nan
Permite inf, -inf, nan. Solo aplicable a números.
TYPE:bool | NoneDEFAULT:_Unset
max_digits
Número máximo de dígitos permitidos para valores decimales.
TYPE:int | NoneDEFAULT:_Unset
decimal_places
Número máximo de decimales permitidos para valores decimales.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defCookie(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.Cookie(default=default,default_factory=default_factory,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
Valor por defecto si el campo del parámetro no está establecido.
TYPE:AnyDEFAULT:Undefined
default_factory
Un callable para generar el valor por defecto.
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:Callable[[], Any] | NoneDEFAULT:_Unset
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
TYPE:str | NoneDEFAULT:None
convert_underscores
Convierte automáticamente los guiones bajos en guiones en el nombre del campo del parámetro.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defHeader(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,convert_underscores:Annotated[bool,Doc(""" Automatically convert underscores to hyphens in the parameter field name. Read more about it in the [FastAPI docs for Header Parameters](https://fastapi.tiangolo.com/tutorial/header-params/#automatic-conversion) """),]=True,title:Annotated[str|None,Doc(""" Human-readable title. """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.Header(default=default,default_factory=default_factory,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,convert_underscores=convert_underscores,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
TYPE:str | NoneDEFAULT:None
title
Título legible por humanos.
TYPE:str | NoneDEFAULT:None
description
Descripción legible por humanos.
TYPE:str | NoneDEFAULT:None
gt
Mayor que. Si se establece, el valor debe ser mayor que esto. Solo aplicable a
números.
TYPE:float | NoneDEFAULT:None
ge
Mayor o igual que. Si se establece, el valor debe ser mayor o igual que
esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
lt
Menor que. Si se establece, el valor debe ser menor que esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
le
Menor o igual que. Si se establece, el valor debe ser menor o igual que esto.
Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
min_length
Longitud mínima para cadenas.
TYPE:int | NoneDEFAULT:None
max_length
Longitud máxima para cadenas.
TYPE:int | NoneDEFAULT:None
pattern
Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
regex
Obsoleto en FastAPI 0.100.0 y Pydantic v2, usa pattern en su lugar. Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
discriminator
Nombre del campo del parámetro para discriminar el tipo en una unión etiquetada.
TYPE:str | NoneDEFAULT:None
strict
Si es True, se aplica validación estricta al campo.
TYPE:bool | NoneDEFAULT:_Unset
multiple_of
El valor debe ser múltiplo de esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:_Unset
allow_inf_nan
Permite inf, -inf, nan. Solo aplicable a números.
TYPE:bool | NoneDEFAULT:_Unset
max_digits
Número máximo de dígitos permitidos para valores decimales.
TYPE:int | NoneDEFAULT:_Unset
decimal_places
Número máximo de decimales permitidos para valores decimales.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defForm(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,media_type:Annotated[str,Doc(""" The media type of this parameter field. Changing it would affect the generated OpenAPI, but currently it doesn't affect the parsing of the data. """),]="application/x-www-form-urlencoded",alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.Form(default=default,default_factory=default_factory,media_type=media_type,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)
Valor por defecto si el campo del parámetro no está establecido.
TYPE:AnyDEFAULT:Undefined
default_factory
Un callable para generar el valor por defecto.
Esto no afecta a los parámetros Path ya que el valor siempre es obligatorio.
El parámetro está disponible solo por compatibilidad.
TYPE:Callable[[], Any] | NoneDEFAULT:_Unset
media_type
El tipo de media de este campo de parámetro. Cambiarlo afectaría al
OpenAPI generado, pero actualmente no afecta al parsing de los datos.
TYPE:strDEFAULT:'multipart/form-data'
alias
Un nombre alternativo para el campo del parámetro.
Esto se usará para extraer los datos y para el OpenAPI generado.
Es particularmente útil cuando no puedes usar el nombre que quieres porque
es una palabra reservada de Python o similar.
TYPE:str | NoneDEFAULT:None
alias_priority
Prioridad del alias. Esto afecta si se usa un generador de alias.
TYPE:int | NoneDEFAULT:_Unset
validation_alias
Paso de validación de 'lista blanca'. El campo del parámetro será el único
permitido por el alias o conjunto de aliases definido.
Paso de validación de 'lista negra'. El campo del parámetro vanilla será el
único de los campos del alias o conjunto de aliases y todos los demás
campos serán ignorados en el momento de la serialización.
TYPE:str | NoneDEFAULT:None
title
Título legible por humanos.
TYPE:str | NoneDEFAULT:None
description
Descripción legible por humanos.
TYPE:str | NoneDEFAULT:None
gt
Mayor que. Si se establece, el valor debe ser mayor que esto. Solo aplicable a
números.
TYPE:float | NoneDEFAULT:None
ge
Mayor o igual que. Si se establece, el valor debe ser mayor o igual que
esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
lt
Menor que. Si se establece, el valor debe ser menor que esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
le
Menor o igual que. Si se establece, el valor debe ser menor o igual que esto.
Solo aplicable a números.
TYPE:float | NoneDEFAULT:None
min_length
Longitud mínima para cadenas.
TYPE:int | NoneDEFAULT:None
max_length
Longitud máxima para cadenas.
TYPE:int | NoneDEFAULT:None
pattern
Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
regex
Obsoleto en FastAPI 0.100.0 y Pydantic v2, usa pattern en su lugar. Patrón RegEx para cadenas.
TYPE:str | NoneDEFAULT:None
discriminator
Nombre del campo del parámetro para discriminar el tipo en una unión etiquetada.
TYPE:str | NoneDEFAULT:None
strict
Si es True, se aplica validación estricta al campo.
TYPE:bool | NoneDEFAULT:_Unset
multiple_of
El valor debe ser múltiplo de esto. Solo aplicable a números.
TYPE:float | NoneDEFAULT:_Unset
allow_inf_nan
Permite inf, -inf, nan. Solo aplicable a números.
TYPE:bool | NoneDEFAULT:_Unset
max_digits
Número máximo de dígitos permitidos para valores decimales.
TYPE:int | NoneDEFAULT:_Unset
decimal_places
Número máximo de decimales permitidos para valores decimales.
Obsoleto en OpenAPI 3.1.0 que ahora usa JSON Schema 2020-12, aunque todavía es compatible. Usa examples en su lugar.
TYPE:Any | NoneDEFAULT:_Unset
openapi_examples
Ejemplos específicos de OpenAPI.
Se añadirá al OpenAPI generado (ej. visible en /docs).
Swagger UI (que proporciona la interfaz /docs) tiene mejor soporte para los
ejemplos específicos de OpenAPI que los examples de JSON Schema, ese es el principal
caso de uso para esto.
Los kwargs extra están obsoletos. Usa json_schema_extra en su lugar. Incluye campos adicionales usados por el JSON Schema.
TYPE:AnyPOR DEFECTO:{}
Código fuente en fastapi/param_functions.py
defFile(# noqa: N802default:Annotated[Any,Doc(""" Default value if the parameter field is not set. """),]=Undefined,*,default_factory:Annotated[Callable[[],Any]|None,Doc(""" A callable to generate the default value. This doesn't affect `Path` parameters as the value is always required. The parameter is available only for compatibility. """),]=_Unset,media_type:Annotated[str,Doc(""" The media type of this parameter field. Changing it would affect the generated OpenAPI, but currently it doesn't affect the parsing of the data. """),]="multipart/form-data",alias:Annotated[str|None,Doc(""" An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI. It is particularly useful when you can't use the name you want because it is a Python reserved keyword or similar. """),]=None,alias_priority:Annotated[int|None,Doc(""" Priority of the alias. This affects whether an alias generator is used. """),]=_Unset,validation_alias:Annotated[str|AliasPath|AliasChoices|None,Doc(""" 'Whitelist' validation step. The parameter field will be the single one allowed by the alias or set of aliases defined. """),]=None,serialization_alias:Annotated[str|None,Doc(""" 'Blacklist' validation step. The vanilla parameter field will be the single one of the alias' or set of aliases' fields and all the other fields will be ignored at serialization time. """),]=None,title:Annotated[str|None,Doc(""" Human-readable title. """),]=None,description:Annotated[str|None,Doc(""" Human-readable description. """),]=None,gt:Annotated[float|None,Doc(""" Greater than. If set, value must be greater than this. Only applicable to numbers. """),]=None,ge:Annotated[float|None,Doc(""" Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. """),]=None,lt:Annotated[float|None,Doc(""" Less than. If set, value must be less than this. Only applicable to numbers. """),]=None,le:Annotated[float|None,Doc(""" Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. """),]=None,min_length:Annotated[int|None,Doc(""" Minimum length for strings. """),]=None,max_length:Annotated[int|None,Doc(""" Maximum length for strings. """),]=None,pattern:Annotated[str|None,Doc(""" RegEx pattern for strings. """),]=None,regex:Annotated[str|None,Doc(""" RegEx pattern for strings. """),deprecated("Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."),]=None,discriminator:Annotated[str|None,Doc(""" Parameter field name for discriminating the type in a tagged union. """),]=None,strict:Annotated[bool|None,Doc(""" If `True`, strict validation is applied to the field. """),]=_Unset,multiple_of:Annotated[float|None,Doc(""" Value must be a multiple of this. Only applicable to numbers. """),]=_Unset,allow_inf_nan:Annotated[bool|None,Doc(""" Allow `inf`, `-inf`, `nan`. Only applicable to numbers. """),]=_Unset,max_digits:Annotated[int|None,Doc(""" Maximum number of digits allowed for decimal values. """),]=_Unset,decimal_places:Annotated[int|None,Doc(""" Maximum number of decimal places allowed for decimal values. """),]=_Unset,examples:Annotated[list[Any]|None,Doc(""" Example values for this field. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/) """),]=None,example:Annotated[Any|None,deprecated("Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, ""although still supported. Use examples instead."),]=_Unset,openapi_examples:Annotated[dict[str,Example]|None,Doc(""" OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at `/docs`). Swagger UI (that provides the `/docs` interface) has better support for the OpenAPI-specific examples than the JSON Schema `examples`, that's the main use case for this. Read more about it in the [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). """),]=None,deprecated:Annotated[deprecated|str|bool|None,Doc(""" Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at `/docs`). """),]=None,include_in_schema:Annotated[bool,Doc(""" To include (or not) this parameter field in the generated OpenAPI. You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at `/docs`). """),]=True,json_schema_extra:Annotated[dict[str,Any]|None,Doc(""" Any additional JSON schema data. """),]=None,**extra:Annotated[Any,Doc(""" Include extra fields used by the JSON Schema. """),deprecated(""" The `extra` kwargs is deprecated. Use `json_schema_extra` instead. """),],)->Any:returnparams.File(default=default,default_factory=default_factory,media_type=media_type,alias=alias,alias_priority=alias_priority,validation_alias=validation_alias,serialization_alias=serialization_alias,title=title,description=description,gt=gt,ge=ge,lt=lt,le=le,min_length=min_length,max_length=max_length,pattern=pattern,regex=regex,discriminator=discriminator,strict=strict,multiple_of=multiple_of,allow_inf_nan=allow_inf_nan,max_digits=max_digits,decimal_places=decimal_places,example=example,examples=examples,openapi_examples=openapi_examples,deprecated=deprecated,include_in_schema=include_in_schema,json_schema_extra=json_schema_extra,**extra,)