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@...>
Date: Wednesday, October 23, 2019 at 10:35 AM
To: Anton Ivanov <anton.ivanov@...>
Cc: "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: [jsonrpc-dev] Deserialization clarification needed

 

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:

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@...>
Date: Wednesday, October 23, 2019 at 10:35 AM
To: Anton Ivanov <anton.ivanov@...>
Cc: "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: [jsonrpc-dev] Deserialization clarification needed

 

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@...>
 

Thanks.

 

BTW, is [{}] a valid param too?

 

-Shaleen

 

 

From: Richard Kosegi <richard.kosegi@...>
Date: Wednesday, October 23, 2019 at 11:26 AM
To: Shaleen Saxena <shaleen.external@...>
Cc: Anton Ivanov <anton.ivanov@...>, "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: Re: [jsonrpc-dev] Deserialization clarification needed

 

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:

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@...>
Date: Wednesday, October 23, 2019 at 10:35 AM
To: Anton Ivanov <anton.ivanov@...>
Cc: "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: [jsonrpc-dev] Deserialization clarification needed

 

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,

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:

Thanks.

 

BTW, is [{}] a valid param too?

 

-Shaleen

 

 

From: Richard Kosegi <richard.kosegi@...>
Date: Wednesday, October 23, 2019 at 11:26 AM
To: Shaleen Saxena <shaleen.external@...>
Cc: Anton Ivanov <anton.ivanov@...>, "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: Re: [jsonrpc-dev] Deserialization clarification needed

 

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:

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@...>
Date: Wednesday, October 23, 2019 at 10:35 AM
To: Anton Ivanov <anton.ivanov@...>
Cc: "jsonrpc-dev@..." <jsonrpc-dev@...>
Subject: [jsonrpc-dev] Deserialization clarification needed

 

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.