connexion.validators

Contains validator classes used by the validation middleware.

Module Contents

Classes

JSONRequestBodyValidator

Request body validator for json content types.

JSONResponseBodyValidator

Response body validator for json content types.

TextResponseBodyValidator

Response body validator for json content types.

FormDataValidator

Request body validator for form content types.

MultiPartFormDataValidator

Request body validator for form content types.

Attributes

logger

VALIDATOR_MAP

connexion.validators.logger
class connexion.validators.JSONRequestBodyValidator(scope: starlette.types.Scope, receive: starlette.types.Receive, *, schema: dict, validator: Type[jsonschema.Draft4Validator] = Draft4RequestValidator, nullable=False, encoding: str, **kwargs)

Request body validator for json content types.

validate(self, body: dict)
static parse(body: str) dict
async wrapped_receive(self) starlette.types.Receive
class connexion.validators.JSONResponseBodyValidator(scope: starlette.types.Scope, send: starlette.types.Send, *, schema: dict, validator: Type[jsonschema.Draft4Validator] = Draft4ResponseValidator, nullable=False, encoding: str)

Response body validator for json content types.

validate(self, body: dict)
static parse(body: str) dict
async send(self, message: MutableMapping[str, Any]) None
class connexion.validators.TextResponseBodyValidator(scope: starlette.types.Scope, send: starlette.types.Send, *, schema: dict, validator: Type[jsonschema.Draft4Validator] = Draft4ResponseValidator, nullable=False, encoding: str)

Bases: JSONResponseBodyValidator

Response body validator for json content types.

static parse(body: str) str
validate(self, body: dict)
async send(self, message: MutableMapping[str, Any]) None
class connexion.validators.FormDataValidator(scope: starlette.types.Scope, receive: starlette.types.Receive, *, schema: dict, validator: Type[jsonschema.Draft4Validator] = None, uri_parser: Optional[connexion.decorators.uri_parsing.AbstractURIParser] = None, nullable=False, encoding: str, strict_validation: bool)

Request body validator for form content types.

property form_parser_cls(self)
check_empty(self)

receive is never called if body is empty, so we need to check this case at initialization.

validate(self, data: starlette.datastructures.FormData) None
async wrapped_receive(self) starlette.types.Receive
class connexion.validators.MultiPartFormDataValidator(scope: starlette.types.Scope, receive: starlette.types.Receive, *, schema: dict, validator: Type[jsonschema.Draft4Validator] = None, uri_parser: Optional[connexion.decorators.uri_parsing.AbstractURIParser] = None, nullable=False, encoding: str, strict_validation: bool)

Bases: FormDataValidator

Request body validator for form content types.

property form_parser_cls(self)
check_empty(self)

receive is never called if body is empty, so we need to check this case at initialization.

validate(self, data: starlette.datastructures.FormData) None
async wrapped_receive(self) starlette.types.Receive
connexion.validators.VALIDATOR_MAP