Mercurial > hg > piper
changeset 64:4e9ea8f177b6 docrefactor
Pull out serialisedArray definition, add tests for both kinds
author | Chris Cannam |
---|---|
date | Wed, 05 Oct 2016 09:37:08 +0100 |
parents | a444a851bd67 |
children | 2f2060509884 |
files | examples/processinput-array.json examples/processinput-base64.json examples/processinput.json schema/feature.json schema/processinput.json test.sh |
diffstat | 6 files changed, 25 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/processinput-array.json Wed Oct 05 09:37:08 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}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/processinput-base64.json Wed Oct 05 09:37:08 2016 +0100 @@ -0,0 +1,1 @@ +{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}}
--- a/examples/processinput.json Tue Sep 27 15:03:29 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -{"inputBuffers":["AACAPwAAAEAEAEBAAACAQAAAoEAAAMBAAADQQAAA4EA"], "timestamp": {"n": 141590000, "s": 3}}
--- a/schema/feature.json Tue Sep 27 15:03:29 2016 +0100 +++ b/schema/feature.json Wed Oct 05 09:37:08 2016 +0100 @@ -14,6 +14,12 @@ "type": "string" }, "featureValues": { + "$ref": "#/definitions/serialisedArray" + } + }, + "additionalProperties": false, + "definitions": { + "serialisedArray": { "anyOf": [ { "type": "array", @@ -24,9 +30,8 @@ "pattern": "^[a-zA-Z0-9+/]*=*$" } ] - } - }, - "additionalProperties": false + } + } }
--- a/schema/processinput.json Tue Sep 27 15:03:29 2016 +0100 +++ b/schema/processinput.json Wed Oct 05 09:37:08 2016 +0100 @@ -10,7 +10,14 @@ "inputBuffers": { "type": "array", "items": { - "anyOf": [ + "$ref": "#/definitions/serialisedArray" + } + } + }, + "additionalProperties": false, + "definitions": { + "serialisedArray": { + "anyOf": [ { "type": "array", "items": { "type": "number" } @@ -19,11 +26,9 @@ "type": "string", "pattern": "^[a-zA-Z0-9+/]*=*$" } - ] - } - } - }, - "additionalProperties": false + ] + } + } }
--- a/test.sh Tue Sep 27 15:03:29 2016 +0100 +++ b/test.sh Wed Oct 05 09:37:08 2016 +0100 @@ -4,12 +4,14 @@ 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