def validate_response(self, data, status_code, headers):
        response_definitions = self.operation.operation["responses"]
        response_definition = response_definitions.get(str(status_code), {})
        response_definition = self.operation.resolve_reference(response_definition)
        # TODO handle default response definitions

        if self.is_json_schema_compatible(response_definition):
            schema = response_definition.get("schema")
            v = ResponseBodyValidator(schema)
            try:
                # For cases of custom encoders, we need to encode and decode to
                # transform to the actual types that are going to be returned.
                data = json.dumps(data)
                data = json.loads(data)

                v.validate_schema(data)
            except ValidationError as e:
                raise NonConformingResponseBody(message=str(e))

        if response_definition and response_definition.get("headers"):
            response_definition_header_keys = response_definition.get("headers").keys()
            if not all(item in headers.keys() for item in response_definition_header_keys):
                raise NonConformingResponseHeaders(
                    message="Keys in header don't match response specification. Difference: %s"
                    % list(set(headers.keys()).symmetric_difference(set(response_definition_header_keys))))
        return True
Validates the Response object based on what has been declared in the specification.
dataset/ETHPy150Open zalando/connexion/connexion/decorators/response.py/ResponseValidator.validate_response