# HG changeset patch # User Chris Cannam # Date 1475657958 -3600 # Node ID 5d50f7c9afc61d22b3135e0053c1c154cdaec146 # Parent 8f3ba64ec888888ee7c932f47011added8354073# Parent ada4cd9daaba46bc2046bab5d891c3e3fd1f1f49 Merge from branch docrefactor diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/feature-array.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/feature-array.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +{"featureValues": [ 1.0, -1.0, 4.0, 1505050.50 ], "label": "A feature", "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/feature-base64.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/feature-base64.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +{"featureValues": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/feature.json --- a/examples/feature.json Wed Oct 05 09:19:05 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -{"featureValues": "AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA", "label": "A feature", "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/processinput-array.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/processinput-array.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +{"inputBuffers":[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/processinput-base64.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/processinput-base64.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/processinput.json --- a/examples/processinput.json Wed Oct 05 09:19:05 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}} diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/serialisedarray-array.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/serialisedarray-array.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +[1,2,-3,3.1415926537] diff -r 8f3ba64ec888 -r 5d50f7c9afc6 examples/serialisedarray-base64.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/serialisedarray-base64.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,1 @@ +"AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA" diff -r 8f3ba64ec888 -r 5d50f7c9afc6 schema/feature.json --- a/schema/feature.json Wed Oct 05 09:19:05 2016 +0100 +++ b/schema/feature.json Wed Oct 05 09:59:18 2016 +0100 @@ -14,16 +14,7 @@ "type": "string" }, "featureValues": { - "anyOf": [ - { - "type": "array", - "items": { "type": "number" } - }, - { - "type": "string", - "pattern": "^[a-zA-Z0-9+/]*=*$" - } - ] + "$ref": "http://vamp-plugins.org/json/schema/serialisedarray#" } }, "additionalProperties": false diff -r 8f3ba64ec888 -r 5d50f7c9afc6 schema/processinput.json --- a/schema/processinput.json Wed Oct 05 09:19:05 2016 +0100 +++ b/schema/processinput.json Wed Oct 05 09:59:18 2016 +0100 @@ -10,18 +10,9 @@ "inputBuffers": { "type": "array", "items": { - "anyOf": [ - { - "type": "array", - "items": { "type": "number" } - }, - { - "type": "string", - "pattern": "^[a-zA-Z0-9+/]*=*$" - } - ] - } - } + "$ref": "http://vamp-plugins.org/json/schema/serialisedarray#" + } + } }, "additionalProperties": false } diff -r 8f3ba64ec888 -r 5d50f7c9afc6 schema/serialisedarray.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/serialisedarray.json Wed Oct 05 09:59:18 2016 +0100 @@ -0,0 +1,20 @@ +{ + "id": "http://vamp-plugins.org/json/schema/serialisedarray#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "schema for alternate serialisations of an array of floating-point values", + "anyOf": [ + { + "type": "array", + "items": { "type": "number" } + }, + { + "type": "string", + "media": { + "binaryEncoding": "base64", + "type": "application/octet-stream" + } + } + ] +} + + diff -r 8f3ba64ec888 -r 5d50f7c9afc6 test.sh --- a/test.sh Wed Oct 05 09:19:05 2016 +0100 +++ b/test.sh Wed Oct 05 09:59:18 2016 +0100 @@ -1,15 +1,16 @@ #!/bin/bash -set -eu for ex in examples/*.json ; do echo "Checking $ex..." 1>&2 - jsonschema -i "$ex" schema/$(basename "$ex") + jsonschema -i "$ex" schema/$(basename "$ex" | sed 's/-[^.]*//') done for s in schema/*.json ; do if [ ! -f examples/$(basename "$s") ]; then - echo "WARNING: No example file for schema $s" + if ! ls -1 examples/$(basename "$s" .json)-*.json >/dev/null 2>&1; then + echo "WARNING: No example file for schema $s" + fi fi done