jnan77 / jsonrpc4j

Automatically exported from code.google.com/p/jsonrpc4j
0 stars 0 forks source link

Feature request: Add switch to allow extra parameters in JSON-RPC calls #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We're implementing a service where the spec requires us to allow and ignore 
extra parameters in the JSON-RPC calls for future proofing.

The JSON-RPC spec does not specify how to handle this, but there are other 
implementations where this is the default behaviour.

I've added a switch (allowExtraParams) which when set will give this behaviour. 

In the attached patch there is also a unit test to test the new functionality 
and to make sure that the original behaviour is preserved when the switch is 
not set.

best regards, 

Hans Jørgen Hoel

Original issue reported on code.google.com by hansj...@gmail.com on 7 Jun 2011 at 12:58

Attachments:

GoogleCodeExporter commented 8 years ago
I'm not sure if i like this patch\idea.  I understand the requirement - but in 
the case that the number (and type) of extra params are known ahead of time it 
would be just as easy to overload the given method with those extra params.  
Can you point me in the direction of the other implementations where this is 
the default behavior?  I'm sure you can understand my reluctance to add this 
patch without further investigation.  Also, sorry for the major delay in 
picking this up :)

Original comment by brian.di...@gmail.com on 20 Sep 2011 at 4:12

GoogleCodeExporter commented 8 years ago

Original comment by brian.di...@gmail.com on 20 Sep 2011 at 4:12

GoogleCodeExporter commented 8 years ago
Hi, sorry for late reply, we've been busy with other projects lately.

The rationale for this switch is that we have a third party system which sends 
requests to us which according to the spec can add new parameters at any time 
in the future. Our end should keep responding to these requests as it did 
before the extra parameters were added.

When I wrote this patch I had a look at how two of the Python implementations 
found at one of the spec sites (jsonrpc.org? can't find the page now) handles 
this. We could check with the JSON-RPC Google group to get some other opinions 
on this.

Original comment by hansj...@gmail.com on 17 Nov 2011 at 4:13

GoogleCodeExporter commented 8 years ago
What I don't like about this is the possibility of calling a method that you 
didn't intend on calling.  ie: you specifically wanted the v2 version of 
doSomethingImportant that has 3 parameters but since the API you're actually 
calling only supports v1 with 2 parameters.  That said, the ability to turn it 
on\off makes it a little more acceptable.  What do other people think?

Original comment by brian.di...@gmail.com on 18 Nov 2011 at 3:46

GoogleCodeExporter commented 8 years ago
Ok, i applied the patch and committed it.  The fact that it's optional and 
defaults to false makes me feel better about it.

Thanks

Original comment by brian.di...@gmail.com on 18 Nov 2011 at 8:03

GoogleCodeExporter commented 8 years ago
Great, thanks. I've verified the patches in version 0.18 (both this
and issue 9).

Original comment by hansj...@gmail.com on 21 Nov 2011 at 1:20

GoogleCodeExporter commented 8 years ago
thanks

Original comment by brian.di...@gmail.com on 21 Nov 2011 at 11:15