The JSON-RPC spec says that the params field of a request or notification is optional; and similarly for the data field on a response error.
However, in many cases omitting params is nonsensical: the user can't ask for a hover without telling us where! And conversely, in the few cases where params aren't necessary, they must be omitted (because there isn't even a param type!).
So the approach we have been taking in HLS is:
If the metamodel specifies a parameter type for a method, then params must be present
If the metamodel does not specify a parameter type, then params must be absent
Is this right? If so, could we say as much in the spec?
There is a similar question for error data: when it is specified in the metamodel that a method has an error data type, does that mean that any errors for that method must include error data, or is it still optional?
The JSON-RPC spec says that the
params
field of a request or notification is optional; and similarly for thedata
field on a response error.However, in many cases omitting
params
is nonsensical: the user can't ask for a hover without telling us where! And conversely, in the few cases whereparams
aren't necessary, they must be omitted (because there isn't even a param type!).So the approach we have been taking in HLS is:
params
must be presentparams
must be absentIs this right? If so, could we say as much in the spec?
There is a similar question for error
data
: when it is specified in the metamodel that a method has an error data type, does that mean that any errors for that method must include error data, or is it still optional?