connexion.decorators.response

This module defines a view function decorator to validate its responses.

Module Contents

Classes

ResponseValidator

type operation:

Operation

Attributes

logger

connexion.decorators.response.logger
class connexion.decorators.response.ResponseValidator(operation, mimetype, validator=None)

Bases: connexion.decorators.decorator.BaseDecorator

Parameters:

validator (jsonschema.IValidator) – Validator class that should be used to validate passed data against API schema.

validate_response(self, data, status_code, headers, url)

Validates the Response object based on what has been declared in the specification. Ensures the response body matches the declared schema. :type data: dict :type status_code: int :type headers: dict :rtype bool | None

is_json_schema_compatible(self, response_schema: dict) bool

Verify if the specified operation responses are JSON schema compatible.

All operations that specify a JSON schema and have content type “application/json” or “text/plain” can be validated using json_schema package.

__call__(self, function)
Return type:

types.FunctionType

__repr__(self)
Return type:

str