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.

參數:
  • 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.

    在 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[原始碼]

基底類別: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, include_in_schema: bool = True, 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.

multipart_form_part_limit: int | None = None

The maximal number of allowed parts in a multipart/formdata request. This limit is intended to protect from DoS attacks.

__hash__() int[原始碼]

Hash the dataclass in a safe way.

回傳:

A hash

litestar.params.Dependency(*, default: Any = _EmptyEnum.EMPTY, skip_validation: bool = False) Any[原始碼]

Create a dependency kwarg definition.

參數:
  • default -- A default value to use in case a dependency is not provided.

  • skip_validation -- If True provided dependency values are not validated by signature model.

class litestar.params.DependencyKwarg[原始碼]

基底類別:object

Data container representing a dependency.

__init__(default: Any = _EmptyEnum.EMPTY, skip_validation: bool = False) None
default: Any = 0

A default value.

skip_validation: bool = False

Flag dictating whether to skip validation.

__hash__() int[原始碼]

Hash the dataclass in a safe way.

回傳:

A hash

class litestar.params.KwargDefinition[原始碼]

基底類別:object

Data container representing a constrained kwarg.

examples: list[Example] | None = None

A list of Example models.

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.

lower_case: bool | None = None

Constrict a string value to be lower case.

upper_case: bool | None = None

Constrict a string value to be upper case.

format: str | None = None

Specify the format to which a string value should be converted.

enum: Sequence[Any] | None = None

A sequence of valid values.

read_only: bool | None = None

A boolean flag dictating whether this parameter is read only.

__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, include_in_schema: bool = True) None
schema_extra: dict[str, Any] | None = None

Extensions to the generated schema.

If set, will overwrite the matching fields in the generated schema.

在 2.8.0 版被加入.

schema_component_key: str | None = None

Use as the key for the reference when creating a component for this type .. versionadded:: 2.12.0

include_in_schema: bool = True

A boolean flag dictating whether this parameter should be included in the schema. .. versionadded:: 2.17.0

property is_constrained: bool

Return True if any of the constraints are set.

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, include_in_schema: bool = True) Any[原始碼]

Create an extended parameter kwarg definition.

參數:
  • 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.

    在 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

  • include_in_schema -- A boolean flag dictating whether this parameter should be included in the schema.

class litestar.params.ParameterKwarg[原始碼]

基底類別: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, include_in_schema: bool = True, 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.

header: str | None = None

The header parameter key - required for header parameters.

cookie: str | None = None

The cookie parameter key - required for cookie parameters.

query: str | None = None

The query parameter key for this parameter.

required: bool | None = None

A boolean flag dictating whether this parameter is required.

If set to False, None values will be allowed. Defaults to True.

__hash__() int[原始碼]

Hash the dataclass in a safe way.

回傳:

A hash