(self, api_name, rpc_name, response)
Validate the parameters for the given event/rpc

        This will raise an `jsonschema.ValidationError` exception on error,
        or return None if valid.

        Note that only RPCs have responses. Accessing this property for an
        event will result in a SchemaNotFound error.
Validate the parameters for the given event/rpc
Validate the parameters for the given event / rpc
def validate_response(self, api_name, rpc_name, response):
        """Validate the parameters for the given event/rpc

        This will raise an `jsonschema.ValidationError` exception on error,
        or return None if valid.

        Note that only RPCs have responses. Accessing this property for an
        event will result in a SchemaNotFound error.
        """
        json_schema = self.get_rpc_schema(api_name, rpc_name)["response"]
        try:
            jsonschema.validate(response, json_schema)
        except jsonschema.ValidationError as e:
            logger.error(e)
            path = list(e.absolute_path)
            if not path:
                raise ValidationError(
                    "Validation error when using JSON schema to validate result from \n"
                    f"RPC {api_name}.{rpc_name}.\n"
                    "\n"
                    "It is likely the response was either of the incorrect type, or "
                    "some fields were erroneously absent/present.\n"
                    "\n"
                    f"The error was: {e.message}\n"
                    "\n"
                    "The full validator error was logged above"
                ) from None
            else:
                raise ValidationError(
                    "Validation error when using JSON schema to validate result from \n"
                    f"RPC {api_name}.{rpc_name}.\n"
                    "\n"
                    "This was an error in validating the internal structure of the \n"
                    "data returned values. The path to this error is \n"
                    f"'<root>.{'.'.join(e.absolute_path)}'.\n"
                    "\n"
                    f"The error given was: {e.message}\n"
                    "\n"
                    "The full validator error was logged above"
                ) from None
def validate_response ( self , api_name , rpc_name , response ) : json_schema = self . get_rpc_schema ( api_name , rpc_name ) [ "response" ] try : jsonschema . validate ( response , json_schema ) except jsonschema . ValidationError as e : logger . error ( e ) path = list ( e . absolute_path ) if not path : raise ValidationError ( "Validation error when using JSON schema to validate result from \n" f"RPC {api_name}.{rpc_name}.\n" "\n" "It is likely the response was either of the incorrect type, or " "some fields were erroneously absent/present.\n" "\n" f"The error was: {e.message}\n" "\n" "The full validator error was logged above" ) from None else : raise ValidationError ( "Validation error when using JSON schema to validate result from \n" f"RPC {api_name}.{rpc_name}.\n" "\n" "This was an error in validating the internal structure of the \n" "data returned values. The path to this error is \n" f"'<root>.{'.'.join(e.absolute_path)}'.\n" "\n" f"The error given was: {e.message}\n" "\n" "The full validator error was logged above" ) from None