connexion.decorators.validation

This module defines view function decorators to validate request and response parameters and bodies.

Module Contents

Classes

ParameterValidator

param parameters:

List of request parameter dictionaries

Functions

coerce_type(param, value, parameter_type, parameter_name=None)

validate_parameter_list(request_params, spec_params)

Attributes

logger

TYPE_MAP

draft4_format_checker

connexion.decorators.validation.logger
connexion.decorators.validation.TYPE_MAP
connexion.decorators.validation.draft4_format_checker
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.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_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)
__call__(self, function)
Return type:

types.FunctionType