starlite.params#

class starlite.params.ParameterKwarg#

Bases: object

Data container representing a parameter.

value_type#

The field value - Empty by default.

alias of Empty

header: Optional[str] = None#

The header parameter key - required for header parameters.

cookie: Optional[str] = None#

The cookie parameter key - required for cookie parameters.

query: Optional[str] = None#

The query parameter key for this parameter.

examples: Optional[List[Example]] = None#

A list of Example models.

external_docs: Optional[ExternalDocumentation] = None#

A url pointing at external documentation for the given parameter.

content_encoding: Optional[str] = None#

The content encoding of the value.

Applicable on to string values. See OpenAPI 3.1 for details.

required: Optional[bool] = None#

A boolean flag dictating whether this parameter is required.

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

default#

A default value.

If const is true, this value is required.

alias of Empty

title: Optional[str] = None#

String value used in the title section of the OpenAPI schema for the given parameter.

description: Optional[str] = None#

String value used in the description section of the OpenAPI schema for the given parameter.

const: Optional[bool] = 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: Optional[float] = None#

Constrict value to be greater than a given float or int.

Equivalent to exclusiveMinimum in the OpenAPI specification.

ge: Optional[float] = None#

Constrict value to be greater or equal to a given float or int.

Equivalent to minimum in the OpenAPI specification.

lt: Optional[float] = None#

Constrict value to be less than a given float or int.

Equivalent to exclusiveMaximum in the OpenAPI specification.

le: Optional[float] = None#

Constrict value to be less or equal to a given float or int.

Equivalent to maximum in the OpenAPI specification.

multiple_of: Optional[float] = None#

Constrict value to a multiple of a given float or int.

Equivalent to multipleOf in the OpenAPI specification.

min_items: Optional[int] = None#

Constrict a set or a list to have a minimum number of items.

Equivalent to minItems in the OpenAPI specification.

max_items: Optional[int] = None#

Constrict a set or a list to have a maximum number of items.

Equivalent to maxItems in the OpenAPI specification.

min_length: Optional[int] = None#

Constrict a string or bytes value to have a minimum length.

Equivalent to minLength in the OpenAPI specification.

max_length: Optional[int] = None#

Constrict a string or bytes value to have a maximum length.

Equivalent to maxLength in the OpenAPI specification.

regex: Optional[str] = None#

A string representing a regex against which the given string will be matched.

Equivalent to pattern in the OpenAPI specification.

__hash__() int#

Hash the dataclass in a safe way.

Returns:

A hash

__init__(value_type: ~typing.Any = <class 'starlite.types.empty.Empty'>, header: ~typing.Optional[str] = None, cookie: ~typing.Optional[str] = None, query: ~typing.Optional[str] = None, examples: ~typing.Optional[~typing.List[Example]] = None, external_docs: ~typing.Optional[ExternalDocumentation] = None, content_encoding: ~typing.Optional[str] = None, required: ~typing.Optional[bool] = None, default: ~typing.Any = <class 'starlite.types.empty.Empty'>, title: ~typing.Optional[str] = None, description: ~typing.Optional[str] = None, const: ~typing.Optional[bool] = None, gt: ~typing.Optional[float] = None, ge: ~typing.Optional[float] = None, lt: ~typing.Optional[float] = None, le: ~typing.Optional[float] = None, multiple_of: ~typing.Optional[float] = None, min_items: ~typing.Optional[int] = None, max_items: ~typing.Optional[int] = None, min_length: ~typing.Optional[int] = None, max_length: ~typing.Optional[int] = None, regex: ~typing.Optional[str] = None) None#
starlite.params.Parameter(value_type: ~typing.Any = <class 'starlite.types.empty.Empty'>, *, header: ~typing.Optional[str] = None, cookie: ~typing.Optional[str] = None, query: ~typing.Optional[str] = None, examples: ~typing.Optional[~typing.List[Example]] = None, external_docs: ~typing.Optional[ExternalDocumentation] = None, content_encoding: ~typing.Optional[str] = None, required: ~typing.Optional[bool] = None, default: ~typing.Any = <class 'starlite.types.empty.Empty'>, title: ~typing.Optional[str] = None, description: ~typing.Optional[str] = None, const: ~typing.Optional[bool] = None, gt: ~typing.Optional[float] = None, ge: ~typing.Optional[float] = None, lt: ~typing.Optional[float] = None, le: ~typing.Optional[float] = None, multiple_of: ~typing.Optional[float] = None, min_items: ~typing.Optional[int] = None, max_items: ~typing.Optional[int] = None, min_length: ~typing.Optional[int] = None, max_length: ~typing.Optional[int] = None, regex: ~typing.Optional[str] = None) Any#

Create an extended parameter kwarg definition.

Parameters:
  • value_typeEmpty by default.

  • header – The header parameter key - required for header parameters.

  • cookie – The cookie parameter key - required for cookie parameters.

  • query – The query parameter key for this parameter.

  • examples – A list of Example models.

  • external_docs – A url pointing at external documentation for the given parameter.

  • content_encoding – The content encoding of the value. Applicable on to string values. See OpenAPI 3.1 for details.

  • required – A boolean flag dictating whether this parameter is required. If set to False, None values will be allowed. Defaults to True.

  • default – A default value. If const is true, this value is required.

  • title – String value used in the title section of the OpenAPI schema for the given parameter.

  • description – String value used in the description section of the OpenAPI schema for the given parameter.

  • 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.

  • gt – Constrict value to be greater than a given float or int. Equivalent to exclusiveMinimum in the OpenAPI specification.

  • ge – Constrict value to be greater or equal to a given float or int. Equivalent to minimum in the OpenAPI specification.

  • lt – Constrict value to be less than a given float or int. Equivalent to exclusiveMaximum 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.

  • multiple_of – Constrict value to a multiple of a given float or int. Equivalent to multipleOf 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.

  • max_items – Constrict a set or a list to have a maximum number of items. Equivalent to maxItems in the OpenAPI specification.

  • min_length – Constrict a string or bytes value to have a minimum length. Equivalent to minLength in the OpenAPI specification.

  • max_length – Constrict a string or bytes value to have a maximum length. Equivalent to maxLength in the OpenAPI specification.

  • regex – A string representing a regex against which the given string will be matched. Equivalent to pattern in the OpenAPI specification.

class starlite.params.BodyKwarg#

Bases: object

Data container representing a request body.

media_type: Union[str, RequestEncodingType] = 'application/json'#

Media-Type of the body.

examples: Optional[List[Example]] = None#

A list of Example models.

__init__(media_type: ~typing.Union[str, RequestEncodingType] = RequestEncodingType.JSON, examples: ~typing.Optional[~typing.List[Example]] = None, external_docs: ~typing.Optional[ExternalDocumentation] = None, content_encoding: ~typing.Optional[str] = None, default: ~typing.Any = <class 'starlite.types.empty.Empty'>, title: ~typing.Optional[str] = None, description: ~typing.Optional[str] = None, const: ~typing.Optional[bool] = None, gt: ~typing.Optional[float] = None, ge: ~typing.Optional[float] = None, lt: ~typing.Optional[float] = None, le: ~typing.Optional[float] = None, multiple_of: ~typing.Optional[float] = None, min_items: ~typing.Optional[int] = None, max_items: ~typing.Optional[int] = None, min_length: ~typing.Optional[int] = None, max_length: ~typing.Optional[int] = None, regex: ~typing.Optional[str] = None, multipart_form_part_limit: ~typing.Optional[int] = None) None#
external_docs: Optional[ExternalDocumentation] = None#

A url pointing at external documentation for the given parameter.

content_encoding: Optional[str] = None#

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.

alias of Empty

title: Optional[str] = None#

String value used in the title section of the OpenAPI schema for the given parameter.

description: Optional[str] = None#

String value used in the description section of the OpenAPI schema for the given parameter.

const: Optional[bool] = 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: Optional[float] = None#

Constrict value to be greater than a given float or int.

Equivalent to exclusiveMinimum in the OpenAPI specification.

ge: Optional[float] = None#

Constrict value to be greater or equal to a given float or int.

Equivalent to minimum in the OpenAPI specification.

lt: Optional[float] = None#

Constrict value to be less than a given float or int.

Equivalent to exclusiveMaximum in the OpenAPI specification.

le: Optional[float] = None#

Constrict value to be less or equal to a given float or int.

Equivalent to maximum in the OpenAPI specification.

multiple_of: Optional[float] = None#

Constrict value to a multiple of a given float or int.

Equivalent to multipleOf in the OpenAPI specification.

min_items: Optional[int] = None#

Constrict a set or a list to have a minimum number of items.

Equivalent to minItems in the OpenAPI specification.

max_items: Optional[int] = None#

Constrict a set or a list to have a maximum number of items.

Equivalent to maxItems in the OpenAPI specification.

min_length: Optional[int] = None#

Constrict a string or bytes value to have a minimum length.

Equivalent to minLength in the OpenAPI specification.

max_length: Optional[int] = None#

Constrict a string or bytes value to have a maximum length.

Equivalent to maxLength in the OpenAPI specification.

regex: Optional[str] = None#

A string representing a regex against which the given string will be matched.

Equivalent to pattern in the OpenAPI specification.

multipart_form_part_limit: Optional[int] = 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.

Returns:

A hash

starlite.params.Body(*, media_type: ~typing.Union[str, RequestEncodingType] = RequestEncodingType.JSON, examples: ~typing.Optional[~typing.List[Example]] = None, external_docs: ~typing.Optional[ExternalDocumentation] = None, content_encoding: ~typing.Optional[str] = None, default: ~typing.Any = <class 'starlite.types.empty.Empty'>, title: ~typing.Optional[str] = None, description: ~typing.Optional[str] = None, const: ~typing.Optional[bool] = None, gt: ~typing.Optional[float] = None, ge: ~typing.Optional[float] = None, lt: ~typing.Optional[float] = None, le: ~typing.Optional[float] = None, multiple_of: ~typing.Optional[float] = None, min_items: ~typing.Optional[int] = None, max_items: ~typing.Optional[int] = None, min_length: ~typing.Optional[int] = None, max_length: ~typing.Optional[int] = None, regex: ~typing.Optional[str] = None, multipart_form_part_limit: ~typing.Optional[int] = None) Any#

Create an extended request body kwarg definition.

Parameters:
  • media_type – Defaults to RequestEncodingType.JSON.

  • examples – A list of Example models.

  • external_docs – A url pointing at external documentation for the given parameter.

  • 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.

  • title – String value used in the title section of the OpenAPI schema for the given parameter.

  • description – String value used in the description section of the OpenAPI schema for the given parameter.

  • 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.

  • gt – Constrict value to be greater than a given float or int. Equivalent to exclusiveMinimum in the OpenAPI specification.

  • ge – Constrict value to be greater or equal to a given float or int. Equivalent to minimum in the OpenAPI specification.

  • lt – Constrict value to be less than a given float or int. Equivalent to exclusiveMaximum 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.

  • multiple_of – Constrict value to a multiple of a given float or int. Equivalent to multipleOf 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.

  • max_items – Constrict a set or a list to have a maximum number of items. Equivalent to maxItems in the OpenAPI specification.

  • min_length – Constrict a string or bytes value to have a minimum length. Equivalent to minLength in the OpenAPI specification.

  • max_length – Constrict a string or bytes value to have a maximum length. Equivalent to maxLength in the OpenAPI specification.

  • regex – A string representing a regex against which the given string will be matched. Equivalent to pattern 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.

class starlite.params.DependencyKwarg#

Bases: object

Data container representing a dependency.

__init__(default: ~typing.Any = <class 'starlite.types.empty.Empty'>, skip_validation: bool = False) None#
default#

A default value.

alias of Empty

skip_validation: bool = False#

Flag dictating whether to skip validation.

__hash__() int#

Hash the dataclass in a safe way.

Returns:

A hash

starlite.params.Dependency(*, default: ~typing.Any = <class 'starlite.types.empty.Empty'>, skip_validation: bool = False) Any#

Create a dependency kwarg definition.

Parameters:
  • 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.