params#
- litestar.params.Body(*, const: bool | None = None, content_encoding: str | None = None, default: Any = _EmptyEnum.EMPTY, description: str | None = None, examples: list[Example] | None = None, external_docs: ExternalDocumentation | None = None, ge: float | None = None, gt: float | None = None, le: float | None = None, lt: float | None = None, max_items: int | None = None, max_length: int | None = None, media_type: str | RequestEncodingType = RequestEncodingType.JSON, min_items: int | None = None, min_length: int | None = None, multipart_form_part_limit: int | None = None, multiple_of: float | None = None, pattern: str | None = None, title: str | None = None, schema_extra: dict[str, Any] | None = None, schema_component_key: str | None = None) Any #
Create an extended request body kwarg definition.
- Parameters:
const¶ – A boolean flag dictating whether this parameter is a constant. If True, the value passed to the parameter must equal its default value. This also causes the OpenAPI const field to be populated with the default value.
content_encoding¶ – The content encoding of the value. Applicable on to string values. See OpenAPI 3.1 for details.
default¶ – A default value. If const is true, this value is required.
description¶ – String value used in the description section of the OpenAPI schema for the given parameter.
examples¶ – A list of Example models.
external_docs¶ – A url pointing at external documentation for the given parameter.
ge¶ – Constrict value to be greater or equal to a given float or int. Equivalent to minimum in the OpenAPI specification.
gt¶ – Constrict value to be greater than a given float or int. Equivalent to exclusiveMinimum in the OpenAPI specification.
le¶ – Constrict value to be less or equal to a given float or int. Equivalent to maximum in the OpenAPI specification.
lt¶ – Constrict value to be less than a given float or int. Equivalent to exclusiveMaximum in the OpenAPI specification.
max_items¶ – Constrict a set or a list to have a maximum number of items. Equivalent to maxItems in the OpenAPI specification.
max_length¶ – Constrict a string or bytes value to have a maximum length. Equivalent to maxLength in the OpenAPI specification.
media_type¶ – Defaults to RequestEncodingType.JSON.
min_items¶ – Constrict a set or a list to have a minimum number of items. Equivalent to minItems in the OpenAPI specification.
min_length¶ – Constrict a string or bytes value to have a minimum length. Equivalent to minLength in the OpenAPI specification.
multipart_form_part_limit¶ – The maximal number of allowed parts in a multipart/formdata request. This limit is intended to protect from DoS attacks.
multiple_of¶ – Constrict value to a multiple of a given float or int. Equivalent to multipleOf in the OpenAPI specification.
pattern¶ – A string representing a regex against which the given string will be matched. Equivalent to pattern in the OpenAPI specification.
title¶ – String value used in the title section of the OpenAPI schema for the given parameter.
schema_extra¶ –
Extensions to the generated schema. If set, will overwrite the matching fields in the generated schema.
New in version 2.8.0.
schema_component_key¶ – Use this as the key for the reference when creating a component for this type .. versionadded:: 2.12.0
- class litestar.params.BodyKwarg#
Bases:
KwargDefinition
Data container representing a request body.
- __init__(examples: list[Example] | None = None, external_docs: ExternalDocumentation | None = None, content_encoding: str | None = None, default: Any = _EmptyEnum.EMPTY, title: str | None = None, description: str | None = None, const: bool | None = None, gt: float | None = None, ge: float | None = None, lt: float | None = None, le: float | None = None, multiple_of: float | None = None, min_items: int | None = None, max_items: int | None = None, min_length: int | None = None, max_length: int | None = None, pattern: str | None = None, lower_case: bool | None = None, upper_case: bool | None = None, format: str | None = None, enum: Sequence[Any] | None = None, read_only: bool | None = None, schema_extra: dict[str, Any] | None = None, schema_component_key: str | None = None, media_type: str | RequestEncodingType = RequestEncodingType.JSON, multipart_form_part_limit: int | None = None) None #
- media_type: str | RequestEncodingType = 'application/json'#
Media-Type of the body.
- litestar.params.Dependency(*, default: Any = _EmptyEnum.EMPTY, skip_validation: bool = False) Any #
Create a dependency kwarg definition.
- class litestar.params.KwargDefinition#
Bases:
object
Data container representing a constrained kwarg.
- external_docs: ExternalDocumentation | None = None#
A url pointing at external documentation for the given parameter.
- content_encoding: str | None = None#
The content encoding of the value.
Applicable on to string values. See OpenAPI 3.1 for details.
- default: Any = 0#
A default value.
If const is true, this value is required.
- title: str | None = None#
String value used in the title section of the OpenAPI schema for the given parameter.
- description: str | None = None#
String value used in the description section of the OpenAPI schema for the given parameter.
- const: bool | None = None#
A boolean flag dictating whether this parameter is a constant.
If True, the value passed to the parameter must equal its default value. This also causes the OpenAPI const field to be populated with the default value.
- gt: float | None = None#
Constrict value to be greater than a given float or int.
Equivalent to exclusiveMinimum in the OpenAPI specification.
- ge: float | None = None#
Constrict value to be greater or equal to a given float or int.
Equivalent to minimum in the OpenAPI specification.
- lt: float | None = None#
Constrict value to be less than a given float or int.
Equivalent to exclusiveMaximum in the OpenAPI specification.
- le: float | None = None#
Constrict value to be less or equal to a given float or int.
Equivalent to maximum in the OpenAPI specification.
- multiple_of: float | None = None#
Constrict value to a multiple of a given float or int.
Equivalent to multipleOf in the OpenAPI specification.
- min_items: int | None = None#
Constrict a set or a list to have a minimum number of items.
Equivalent to minItems in the OpenAPI specification.
- max_items: int | None = None#
Constrict a set or a list to have a maximum number of items.
Equivalent to maxItems in the OpenAPI specification.
- min_length: int | None = None#
Constrict a string or bytes value to have a minimum length.
Equivalent to minLength in the OpenAPI specification.
- max_length: int | None = None#
Constrict a string or bytes value to have a maximum length.
Equivalent to maxLength in the OpenAPI specification.
- pattern: str | None = None#
A string representing a regex against which the given string will be matched.
Equivalent to pattern in the OpenAPI specification.
- __init__(examples: list[Example] | None = None, external_docs: ExternalDocumentation | None = None, content_encoding: str | None = None, default: Any = _EmptyEnum.EMPTY, title: str | None = None, description: str | None = None, const: bool | None = None, gt: float | None = None, ge: float | None = None, lt: float | None = None, le: float | None = None, multiple_of: float | None = None, min_items: int | None = None, max_items: int | None = None, min_length: int | None = None, max_length: int | None = None, pattern: str | None = None, lower_case: bool | None = None, upper_case: bool | None = None, format: str | None = None, enum: Sequence[Any] | None = None, read_only: bool | None = None, schema_extra: dict[str, Any] | None = None, schema_component_key: str | None = None) None #
- schema_extra: dict[str, Any] | None = None#
Extensions to the generated schema.
If set, will overwrite the matching fields in the generated schema.
New in version 2.8.0.
- litestar.params.Parameter(annotation: Any = _EmptyEnum.EMPTY, *, const: bool | None = None, content_encoding: str | None = None, cookie: str | None = None, default: Any = _EmptyEnum.EMPTY, description: str | None = None, examples: list[Example] | None = None, external_docs: ExternalDocumentation | None = None, ge: float | None = None, gt: float | None = None, header: str | None = None, le: float | None = None, lt: float | None = None, max_items: int | None = None, max_length: int | None = None, min_items: int | None = None, min_length: int | None = None, multiple_of: float | None = None, pattern: str | None = None, query: str | None = None, required: bool | None = None, title: str | None = None, schema_extra: dict[str, Any] | None = None, schema_component_key: str | None = None) Any #
Create an extended parameter kwarg definition.
- Parameters:
annotation¶ – Empty by default.
const¶ – A boolean flag dictating whether this parameter is a constant. If True, the value passed to the parameter must equal its default value. This also causes the OpenAPI const field to be populated with the default value.
content_encoding¶ – The content encoding of the value. Applicable on to string values. See OpenAPI 3.1 for details.
cookie¶ – The cookie parameter key - required for cookie parameters.
default¶ – A default value. If const is true, this value is required.
description¶ – String value used in the description section of the OpenAPI schema for the given parameter.
examples¶ – A list of Example models.
external_docs¶ – A url pointing at external documentation for the given parameter.
ge¶ – Constrict value to be greater or equal to a given float or int. Equivalent to minimum in the OpenAPI specification.
gt¶ – Constrict value to be greater than a given float or int. Equivalent to exclusiveMinimum in the OpenAPI specification.
header¶ – The header parameter key - required for header parameters.
le¶ – Constrict value to be less or equal to a given float or int. Equivalent to maximum in the OpenAPI specification.
lt¶ – Constrict value to be less than a given float or int. Equivalent to exclusiveMaximum in the OpenAPI specification.
max_items¶ – Constrict a set or a list to have a maximum number of items. Equivalent to maxItems in the OpenAPI specification.
max_length¶ – Constrict a string or bytes value to have a maximum length. Equivalent to maxLength in the OpenAPI specification.
min_items¶ – Constrict a set or a list to have a minimum number of items. ֿ Equivalent to minItems in the OpenAPI specification.
min_length¶ – Constrict a string or bytes value to have a minimum length. Equivalent to minLength in the OpenAPI specification.
multiple_of¶ – Constrict value to a multiple of a given float or int. Equivalent to multipleOf in the OpenAPI specification.
pattern¶ – A string representing a regex against which the given string will be matched. Equivalent to pattern in the OpenAPI specification.
query¶ – The query parameter key for this parameter.
required¶ – A boolean flag dictating whether this parameter is required. If set to False, None values will be allowed. Defaults to True.
title¶ – String value used in the title section of the OpenAPI schema for the given parameter.
schema_extra¶ –
Extensions to the generated schema. If set, will overwrite the matching fields in the generated schema.
New in version 2.8.0.
schema_component_key¶ – Use this as the key for the reference when creating a component for this type .. versionadded:: 2.12.0
- class litestar.params.ParameterKwarg#
Bases:
KwargDefinition
Data container representing a parameter.
- __init__(examples: list[Example] | None = None, external_docs: ExternalDocumentation | None = None, content_encoding: str | None = None, default: Any = _EmptyEnum.EMPTY, title: str | None = None, description: str | None = None, const: bool | None = None, gt: float | None = None, ge: float | None = None, lt: float | None = None, le: float | None = None, multiple_of: float | None = None, min_items: int | None = None, max_items: int | None = None, min_length: int | None = None, max_length: int | None = None, pattern: str | None = None, lower_case: bool | None = None, upper_case: bool | None = None, format: str | None = None, enum: Sequence[Any] | None = None, read_only: bool | None = None, schema_extra: dict[str, Any] | None = None, schema_component_key: str | None = None, annotation: Any = _EmptyEnum.EMPTY, header: str | None = None, cookie: str | None = None, query: str | None = None, required: bool | None = None) None #
- annotation: Any = 0#
The field value - Empty by default.