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

        This will raise an `jsonschema.ValidationError` exception on error,
        or return None if valid.
Validate the parameters for the given event/rpc
Validate the parameters for the given event / rpc
def validate_parameters(self, api_name, event_or_rpc_name, parameters):
        """Validate the parameters for the given event/rpc

        This will raise an `jsonschema.ValidationError` exception on error,
        or return None if valid.
        """
        json_schema = self.get_event_or_rpc_schema(api_name, event_or_rpc_name)["parameters"]
        try:
            jsonschema.validate(parameters, 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 parameters for \n"
                    f"{api_name}.{event_or_rpc_name}.\n"
                    "\n"
                    "It is likely you have included an unwanted parameter or omitted a required \n"
                    "parameter.\n"
                    "\n"
                    f"The error was: {e.message}\n"
                    "\n"
                    "The full validator error was logged above"
                ) from None
            elif len(path) == 1:
                raise ValidationError(
                    "Validation error when using JSON schema to validate parameters for \n"
                    f"{api_name}.{event_or_rpc_name}.\n"
                    "\n"
                    "It is likely that you have passed in an invalid value for the \n"
                    f"'{path[0]}' parameter.\n"
                    "\n"
                    f"The error given 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 parameters for \n"
                    f"{api_name}.{event_or_rpc_name}.\n"
                    "\n"
                    "This was an error in validating the internal structure of one \n"
                    "of the parameters' 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_parameters ( self , api_name , event_or_rpc_name , parameters ) : json_schema = self . get_event_or_rpc_schema ( api_name , event_or_rpc_name ) [ "parameters" ] try : jsonschema . validate ( parameters , 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 parameters for \n" f"{api_name}.{event_or_rpc_name}.\n" "\n" "It is likely you have included an unwanted parameter or omitted a required \n" "parameter.\n" "\n" f"The error was: {e.message}\n" "\n" "The full validator error was logged above" ) from None elif len ( path ) == 1 : raise ValidationError ( "Validation error when using JSON schema to validate parameters for \n" f"{api_name}.{event_or_rpc_name}.\n" "\n" "It is likely that you have passed in an invalid value for the \n" f"'{path[0]}' parameter.\n" "\n" f"The error given 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 parameters for \n" f"{api_name}.{event_or_rpc_name}.\n" "\n" "This was an error in validating the internal structure of one \n" "of the parameters' 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