Mercurial > hg > piper
changeset 63:8f3ba64ec888 jsonrpc
Start reworking request-response into json-rpc format
author | Chris Cannam |
---|---|
date | Wed, 05 Oct 2016 09:19:05 +0100 |
parents | a444a851bd67 |
children | 5d50f7c9afc6 |
files | schema/request.json schema/response.json |
diffstat | 2 files changed, 60 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/schema/request.json Tue Sep 27 15:03:29 2016 +0100 +++ b/schema/request.json Wed Oct 05 09:19:05 2016 +0100 @@ -1,22 +1,31 @@ { "id": "http://vamp-plugins.org/json/schema/request#", "$schema": "http://json-schema.org/draft-04/schema#", - "description": "schema for a simple serialised request", + "description": "schema for a serialised request compatible with JSON-RPC", "type": "object", "properties": { - "type": { + "method": { "type": "string" }, - "content": { + "params": { "anyOf": [ { "$ref": "http://vamp-plugins.org/json/schema/loadrequest#" }, { "$ref": "http://vamp-plugins.org/json/schema/configurationrequest#" }, { "$ref": "http://vamp-plugins.org/json/schema/processrequest#" }, { "$ref": "http://vamp-plugins.org/json/schema/finishrequest#" } ] - } + }, + "id": { + "anyOf": [ + { "type": "string" }, + { "type": "number" } + ] + }, + "jsonrpc": { + "type": "string" + } }, - "required": [ "type" ], + "required": [ "method" ], "additionalProperties": false }
--- a/schema/response.json Tue Sep 27 15:03:29 2016 +0100 +++ b/schema/response.json Wed Oct 05 09:19:05 2016 +0100 @@ -3,27 +3,50 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "schema for a success or failure response to a request", "type": "object", - "properties": { - "type": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "errorText": { - "type": "string" - }, - "content": { - "anyOf": [ - { "$ref": "http://vamp-plugins.org/json/schema/listresponse#" }, - { "$ref": "http://vamp-plugins.org/json/schema/loadresponse#" }, - { "$ref": "http://vamp-plugins.org/json/schema/configurationresponse#" }, - { "$ref": "http://vamp-plugins.org/json/schema/processresponse#" }, - { "$ref": "http://vamp-plugins.org/json/schema/finishresponse#" } - ] - } - }, - "required": [ "type", "success" ], - "additionalProperties": false + "oneOf": [ + { + "properties": { + "result": { + "anyOf": [ + { "$ref": "http://vamp-plugins.org/json/schema/listresponse#" }, + { "$ref": "http://vamp-plugins.org/json/schema/loadresponse#" }, + { "$ref": "http://vamp-plugins.org/json/schema/configurationresponse#" }, + { "$ref": "http://vamp-plugins.org/json/schema/processresponse#" }, + { "$ref": "http://vamp-plugins.org/json/schema/finishresponse#" } + ] + }, + "id": { + "anyOf": [ + { "type": "string" }, + { "type": "number" } + ] + }, + "jsonrpc": { + "type": "string" + } + }, + "required": [ "result" ], + "additionalProperties": false + }, + { + "properties": { + "error": { + { "$ref": "http://vamp-plugins.org/json/schema/error#" } + }, + "id": { + "anyOf": [ + { "type": "string" }, + { "type": "number" } + ] + }, + "jsonrpc": { + "type": "string" + } + }, + "required": [ "error" ], + "additionalProperties": false + } + ] } - + +