changeset 154:d3b7d5185e55

Fill out request/response/error
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 05 Oct 2016 11:16:03 +0100
parents a0081894717e
children 783ac54281de
files examples/error.json examples/request.json examples/response-error.json examples/response-ok.json examples/response.json schema/error.json schema/response.json test.sh
diffstat 8 files changed, 59 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- /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!" }
--- 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"}
 
--- /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"}
--- /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"}
--- 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."}
--- /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" ]
+}
+
--- 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
+    } ]
 }
     
         
--- 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