Clarification wanted on request object method names

129 views
Skip to first unread message

Dwayne Crooks

unread,
Oct 20, 2022, 7:46:45 AM10/20/22
to JSON-RPC
Hi,

I'm writing a library for the JSON-RPC specification and I wanted to get clarification on request object method names.

The spec says:

Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.

Does it mean that,

{"jsonrpc": "2.0", "method": "rpc.subtract", "params": [42, 23], "id": 1}

is an invalid request object?

Also, I noticed that the following Python library, https://github.com/pavlov99/json-rpc, raises an error (see https://github.com/pavlov99/json-rpc/blob/00b24a9e811d9ca89ec3b1570195c881687bbef4/jsonrpc/jsonrpc2.py#L74-L79) if the method name starts with "rpc.". Is this recommended behavior?

Matt (MPCM)

unread,
Jan 1, 2023, 9:22:49 AM1/1/23
to JSON-RPC
It is a valid request object. But if you were building a public facing jsonrpc end point, that part of the spec is to discourage you naming methods that start with "rpc."

The python library that raises an error is fine, because methods named that way should be avoided.

Reply all
Reply to author
Forward
0 new messages