diff options
author | Jared Wasinger <j-wasinger@hotmail.com> | 2017-07-06 04:00:01 +0800 |
---|---|---|
committer | Ubuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal> | 2017-08-08 04:41:46 +0800 |
commit | 6117849a700de4d1fcb7245b2cfffbd3382c6cf8 (patch) | |
tree | f010521a6db40ae6dfe488d4579366f6929b9ab7 /JSONSchema | |
parent | 7378b9fa4e883484af856df99a65c28293613e98 (diff) | |
download | dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar.gz dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar.bz2 dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar.lz dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar.xz dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.tar.zst dexon-tests-6117849a700de4d1fcb7245b2cfffbd3382c6cf8.zip |
use JS for json schema validation because the Node 'jsonschema' library is the only one (that I have found) to correctly handle 'additionalProperties' as a boolean (https://spacetelescope.github.io/understanding-json-schema/reference/object.html)
Diffstat (limited to 'JSONSchema')
-rw-r--r-- | JSONSchema/schema.json | 12 | ||||
-rwxr-xr-x | JSONSchema/validate.js | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/JSONSchema/schema.json b/JSONSchema/schema.json index 5ac5e7a71..6e7113950 100644 --- a/JSONSchema/schema.json +++ b/JSONSchema/schema.json @@ -22,7 +22,8 @@ "Metropolis": { "type": "array" } - } }, + } + }, "explanation": { "type": "string" }, @@ -53,7 +54,8 @@ "type": "string", "pattern": "^0x[0-9a-f]*$" } - } + }, + "additionalproperties": false }, "pre": { "type": "object", @@ -79,7 +81,8 @@ } } } - } + }, + "additionalProperties": false }, "transaction": { "type": "object", @@ -121,7 +124,8 @@ "pattern": "^0x[0-9a-f]*$" } } - } + }, + "additionalProperties": false } } } diff --git a/JSONSchema/validate.js b/JSONSchema/validate.js index 368d28da2..6c44b834f 100755 --- a/JSONSchema/validate.js +++ b/JSONSchema/validate.js @@ -15,7 +15,7 @@ var rl = readline.createInterface({ }); rl.on('line', function(line){ - fs.readFile('schema.json', function(err, data) { + fs.readFile('JSONSchema/schema.json', function(err, data) { if (err) { throw err; } |