connexion.decorators.validation
¶
This module defines view function decorators to validate request and response parameters and bodies.
Module Contents¶
Classes¶
|
|
|
|
|
Functions¶
|
|
|
Attributes¶
- connexion.decorators.validation.logger¶
- connexion.decorators.validation.TYPE_MAP¶
- exception connexion.decorators.validation.TypeValidationError(schema_type, parameter_type, parameter_name)¶
Bases:
Exception
Common base class for all non-exit exceptions.
Exception raise when type validation fails
- Returns
- class __cause__¶
exception cause
- class __context__¶
exception context
- class __suppress_context__¶
- class __traceback__¶
- class args¶
- __str__(self)¶
Return str(self).
- __delattr__()¶
Implement delattr(self, name).
- __dir__()¶
Default dir() implementation.
- __eq__()¶
Return self==value.
- __format__()¶
Default object formatter.
- __ge__()¶
Return self>=value.
- __getattribute__()¶
Return getattr(self, name).
- __gt__()¶
Return self>value.
- __hash__()¶
Return hash(self).
- __le__()¶
Return self<=value.
- __lt__()¶
Return self<value.
- __ne__()¶
Return self!=value.
- __reduce__()¶
Helper for pickle.
- __reduce_ex__()¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__()¶
Implement setattr(self, name, value).
- __setstate__()¶
- __sizeof__()¶
Size of object in memory, in bytes.
- __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- connexion.decorators.validation.coerce_type(param, value, parameter_type, parameter_name=None)¶
- connexion.decorators.validation.validate_parameter_list(request_params, spec_params)¶
- class connexion.decorators.validation.RequestBodyValidator(schema, consumes, api, is_null_value_valid=False, validator=None, strict_validation=False)¶
- Parameters
schema – The schema of the request body
consumes – The list of content types the operation consumes
is_null_value_valid – Flag to indicate if null is accepted as valid value.
validator (jsonschema.IValidator) – Validator class that should be used to validate passed data against API schema. Default is jsonschema.Draft4Validator.
strict_validation – Flag indicating if parameters not in spec are allowed
- validate_formdata_parameter_list(self, request)¶
- __call__(self, function)¶
- Return type
types.FunctionType
- validate_schema(self: dict, data: AnyStr, url) Union[connexion.lifecycle.ConnexionResponse, None] ¶
- class connexion.decorators.validation.ResponseBodyValidator(schema, validator=None)¶
- Parameters
schema – The schema of the response body
validator (jsonschema.IValidator) – Validator class that should be used to validate passed data against API schema. Default is Draft4ResponseValidator.
- validate_schema(self: dict, data: AnyStr, url) Union[connexion.lifecycle.ConnexionResponse, None] ¶
- class connexion.decorators.validation.ParameterValidator(parameters, api, strict_validation=False)¶
- Parameters
parameters – List of request parameter dictionaries
api – api that the validator is attached to
strict_validation – Flag indicating if parameters not in spec are allowed
- static validate_parameter(parameter_type, value, param, param_name=None)¶
- validate_query_parameter_list(self, request)¶
- validate_formdata_parameter_list(self, request)¶
- validate_query_parameter(self, param, request)¶
Validate a single query parameter (request.args in Flask)
- Return type
str
- validate_path_parameter(self, param, request)¶
- validate_header_parameter(self, param, request)¶
- validate_cookie_parameter(self, param, request)¶
- validate_formdata_parameter(self, param_name, param, request)¶
- __call__(self, function)¶
- Return type
types.FunctionType