Deserialization clarification needed
Richard Kosegi
Hi Anton, I have situation where I have following RPC rpc some-rpc { output { leaf out { type string; } } } note no input arguments. Java method signature is public String someRpc(); When request such as {"jsonrpc": "2.0", "id": 1, "method": "some-rpc", "params": {}} comes to JSONRPC deserializer, it is treated as invalid, because method is not matched. Should empty object be accepted in same way like empty array (ie. no-args method call) ? Thanks, Richard.
|
|
Shaleen Saxena <shaleen.external@...>
Hi Richard,
Just to clarify, would the following request match? {"jsonrpc": "2.0", "id": 1, "method": "some-rpc", "params": []} That is, params are [] instead of {}.
Regards, Shaleen
From:
"jsonrpc-dev@..." <jsonrpc-dev@...> on behalf of Richard Kosegi <richard.kosegi@...>
Hi Anton,
I have situation where I have following RPC
rpc some-rpc { output { leaf out { type string; } } }
note no input arguments.
Java method signature is
public String someRpc();
When request such as
{"jsonrpc": "2.0", "id": 1, "method": "some-rpc", "params": {}}
comes to JSONRPC deserializer, it is treated as invalid, because method is not matched. Should empty object be accepted in same way like empty array (ie. no-args method call) ?
Thanks, Richard.
|
|
Richard Kosegi
Hi Shaleen, yes it does match method when [] is provided instead of {} Regards, Richard
On Wed, Oct 23, 2019 at 2:37 PM Shaleen Saxena <shaleen.external@...> wrote:
|
|
Shaleen Saxena <shaleen.external@...>
Thanks.
BTW, is [{}] a valid param too?
-Shaleen
From:
Richard Kosegi <richard.kosegi@...>
Hi Shaleen,
yes it does match method when [] is provided instead of {}
Regards, Richard
On Wed, Oct 23, 2019 at 2:37 PM Shaleen Saxena <shaleen.external@...> wrote:
|
|
Richard Kosegi
Hi, outer [] will be unwrapped, so it is valid only for method that accepts single object (JsonElement) argument. Richard.
On Wed, Oct 23, 2019 at 3:27 PM Shaleen Saxena <shaleen.external@...> wrote:
|
|