[Matt should like this]
One thing to consider is that once JSON-RPC becomes a standard
reference, all implementations should supports all its specified
features to say it supports JSON-RPC 2.0
To be widely implemented and become a standard not only on "paper" via
RFC or ISO or anything else, but also in facts in products, the battle
is easier if JSON-RPC is modularized
JSON imposed itself because it was simple, so people liked XML-RPC
-Lack of support for headers in JSON-RPC
As I can read it, the JSON-RPC 2.0 specification defines a list of
properties which must or must not be included into request and
response objects
It doesn't prevent from adding implementation specific properties
which should be considered as extensions
Has we talk in some discussions, additional properties might be
interesting to add shared contexts, or batch constraints.
-Lack of support for multiple errors
The first level of error handling is to be aware of problems and kind
of problems (error exists, here the code of its family)
This help default behavior when a problem occur and the client should
be upset by details in production mode, they'll be required only in
development and debugging mode
As the error is a JSON object, it is really easy to add it a stack
property for details in these mode. That kind of good extension.
ex:
{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error",
"stack":[
{"code": 4242, "message": "Memory full on line 42"},
{"code": 4201, "message": "Can't create resultset"}
]
},
id: "5"
}
-Can't return error and result simultaneously.
This is right as you say for warning or notice, but it shouldn't for
errors
Why not using a "warning" header (has HTTP does ;-) ). You might
define it as a string, an object with code and message, or directly a
stack.
"notice" and "log" headers could also be supported
That's another interesting extension
ex:
{
"jsonrpc": "2.0",
"result": -19,
"warning":"Some non locked values may not have been up to date
while computing",
"id": 2
}
-id is unnecessary
Actually you can set the same value to id in each request if you don't
need it
The recommendation is just not setting it to null, but it can be 0 or
false or any other scalar value.
So if you can think it as modules more server will be able to make
their choice and more important, choose from their priorities when
they try to implement most of these features
my 0,02 €
(I'm in France ;-) )
Alexandre