forked from mirage/ocaml-rpc
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a `version` argument to `Jsonrpc.string_of_{call;response}`, and updates the `of_string` functions accordingly. The main changes compared to JSON-RPC v1 are: 1. And added version field: `{jsonrpc: "2.0"}`. 2. Support for named parameters in requests: `params: {"name1": "value2", "name2", "value2"}`. 3. Responses have a `result` OR an `error`, but not both. Regarding (2), since the `RPC.call` type defines its `params` as a `t list`, it does not have support for named parameters in the type itself. Positional params are still treated as in V1, by putting them in an array (`params: [value1, value2]`). To overcome this, we assume that if the first parameter in this list has an `Rpc.Dict` type, and this is the only parameter, that the dictionary contains named parameters. Fixes mirage#32 Signed-off-by: Rob Hoes <[email protected]>
- Loading branch information
Showing
2 changed files
with
104 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters