# HG changeset patch # User Chris Cannam # Date 1475662563 -3600 # Node ID 9e3ea87dad6e5f9676c485245c0ffa4d9d365992 # Parent 5d50f7c9afc61d22b3135e0053c1c154cdaec146 Fill out request/response/error diff -r 5d50f7c9afc6 -r 9e3ea87dad6e examples/error.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/error.json Wed Oct 05 11:16:03 2016 +0100 @@ -0,0 +1,1 @@ +{"code": 6, "message": "An error occurred!" } diff -r 5d50f7c9afc6 -r 9e3ea87dad6e examples/request.json --- a/examples/request.json Wed Oct 05 09:59:18 2016 +0100 +++ b/examples/request.json Wed Oct 05 11:16:03 2016 +0100 @@ -1,2 +1,2 @@ -{"type": "load", "content": {"pluginKey":"vamp-example-plugins:percussiononsets","inputSampleRate":44100,"adapterFlags":["AdaptInputDomain","AdaptBufferSize"]}} +{"method": "load", "params": {"pluginKey":"vamp-example-plugins:percussiononsets","inputSampleRate":44100,"adapterFlags":["AdaptInputDomain","AdaptBufferSize"]}, "id": 6, "jsonrpc": "2.0"} diff -r 5d50f7c9afc6 -r 9e3ea87dad6e examples/response-error.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/response-error.json Wed Oct 05 11:16:03 2016 +0100 @@ -0,0 +1,1 @@ +{"error": {"code": 6, "message": "An error occurred!" },"id": "6"} diff -r 5d50f7c9afc6 -r 9e3ea87dad6e examples/response-ok.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/response-ok.json Wed Oct 05 11:16:03 2016 +0100 @@ -0,0 +1,1 @@ +{"result": {"pluginHandle":12345,"staticData":{"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "copyright": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005. Freely redistributable (BSD license)", "inputDomain": "FrequencyDomain", "pluginKey": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "pluginVersion": 2},"defaultConfiguration":{"blockSize": 512, "channelCount": 2, "parameterValues": {"sensitivity": 40, "threshold": 3}, "stepSize": 1024}},"id": "6"} diff -r 5d50f7c9afc6 -r 9e3ea87dad6e examples/response.json --- a/examples/response.json Wed Oct 05 09:59:18 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -{"type": "load", "success": true, "content": {"pluginHandle":12345,"staticData":{"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "copyright": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005. Freely redistributable (BSD license)", "inputDomain": "FrequencyDomain", "pluginKey": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "pluginVersion": 2},"defaultConfiguration":{"blockSize": 512, "channelCount": 2, "parameterValues": {"sensitivity": 40, "threshold": 3}, "stepSize": 1024}},"errorText":"I like weevils."} diff -r 5d50f7c9afc6 -r 9e3ea87dad6e schema/error.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/error.json Wed Oct 05 11:16:03 2016 +0100 @@ -0,0 +1,16 @@ +{ + "id": "http://vamp-plugins.org/json/schema/error#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "schema for an error object in a response to a request", + "type": "object", + "properties": { + "code": { + "type": "number" + }, + "message": { + "type": "string" + } + }, + "required": [ "code", "message" ] +} + diff -r 5d50f7c9afc6 -r 9e3ea87dad6e schema/response.json --- a/schema/response.json Wed Oct 05 09:59:18 2016 +0100 +++ b/schema/response.json Wed Oct 05 11:16:03 2016 +0100 @@ -3,50 +3,47 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "schema for a success or failure response to a request", "type": "object", - "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" - } + "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" } + ] }, - "required": [ "result" ], - "additionalProperties": false + "jsonrpc": { + "type": "string" + } }, - { - "properties": { - "error": { - { "$ref": "http://vamp-plugins.org/json/schema/error#" } - }, - "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" } + ] }, - "required": [ "error" ], - "additionalProperties": false - } - ] + "jsonrpc": { + "type": "string" + } + }, + "required": [ "error" ], + "additionalProperties": false + } ] } diff -r 5d50f7c9afc6 -r 9e3ea87dad6e test.sh --- a/test.sh Wed Oct 05 09:59:18 2016 +0100 +++ b/test.sh Wed Oct 05 11:16:03 2016 +0100 @@ -1,5 +1,6 @@ #!/bin/bash +set -eu for ex in examples/*.json ; do echo "Checking $ex..." 1>&2