changeset 62:a444a851bd67

Instead of using separate values and b64values entries, allow numeric arrays to be replaced by b64 variants wherever they appear (discriminating by type). Also rename values to featureValues in feature, as values turns out to be a hazardous name in a JS context
author Chris Cannam
date Tue, 27 Sep 2016 15:03:29 +0100
parents 60c53d43a32b
children 8f3ba64ec888 4e9ea8f177b6 11417ac4d7a4
files examples/feature.json examples/featureset.json examples/processinput.json examples/processrequest.json examples/processresponse.json schema/feature.json schema/processinput.json
diffstat 7 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/examples/feature.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/examples/feature.json	Tue Sep 27 15:03:29 2016 +0100
@@ -1,1 +1,1 @@
-{"b64values": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}
+{"featureValues": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}
--- a/examples/featureset.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/examples/featureset.json	Tue Sep 27 15:03:29 2016 +0100
@@ -1,1 +1,1 @@
-{"outputid": [{"b64values": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}]}
+{"outputid": [{"featureValues": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}]}
--- a/examples/processinput.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/examples/processinput.json	Tue Sep 27 15:03:29 2016 +0100
@@ -1,1 +1,1 @@
-{"inputBuffers":[{"b64values": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"}], "timestamp": {"n": 141590000, "s": 3}}
+{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}}
--- a/examples/processrequest.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/examples/processrequest.json	Tue Sep 27 15:03:29 2016 +0100
@@ -1,1 +1,1 @@
-{"pluginHandle":12345,"processInput":{"inputBuffers":[{"b64values": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"}], "timestamp": {"n": 141590000, "s": 3}}}
+{"pluginHandle":12345,"processInput":{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}}}
--- a/examples/processresponse.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/examples/processresponse.json	Tue Sep 27 15:03:29 2016 +0100
@@ -1,2 +1,2 @@
-{"pluginHandle":12345,"features":{"outputid": [{"b64values": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}]}}
+{"pluginHandle":12345,"features":{"outputid": [{"featureValues": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}}]}}
 
--- a/schema/feature.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/schema/feature.json	Tue Sep 27 15:03:29 2016 +0100
@@ -13,12 +13,17 @@
 	"label": {
 	    "type": "string"
 	},
-	"values": {
-	    "type": "array",
-	    "items": { "type": "number" }
-	},
-	"b64values": {
-	    "type": "string"
+	"featureValues": {
+            "anyOf": [
+                {
+		    "type": "array",
+		    "items": { "type": "number" }
+		},
+                {
+		    "type": "string",
+                    "pattern": "^[a-zA-Z0-9+/]*=*$"
+		}
+            ]
 	}
     },
     "additionalProperties": false
--- a/schema/processinput.json	Tue Sep 27 11:19:19 2016 +0100
+++ b/schema/processinput.json	Tue Sep 27 15:03:29 2016 +0100
@@ -10,16 +10,16 @@
 	"inputBuffers": {
 	    "type": "array",
 	    "items": {
-		"type": "object",
-		"properties": {
-		    "values": {
+                "anyOf": [
+                    {
 			"type": "array",
 			"items": { "type": "number" }
 		    },
-		    "b64values": {
-			"type": "string"
+                    {
+		        "type": "string",
+                        "pattern": "^[a-zA-Z0-9+/]*=*$"
 		    }
-		}
+                ]
 	    }
 	}
     },