From 81d2d559f161026d7633a5c09d5e28fe3e2e5ebf Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 22 Jun 2021 22:02:59 +0100 Subject: Enforce all dicts with a fixed set of keys in test.json schema Improve test.json schema to disallow arbitrary keys in all dicts which have a defined set of keys (the 'installed', matrix 'options' and 'stdout' dicts). Add 'count' and 'comment' keys to 'stdout' dict. --- data/test.schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'data/test.schema.json') diff --git a/data/test.schema.json b/data/test.schema.json index aa3cf8fec..43c1392c1 100644 --- a/data/test.schema.json +++ b/data/test.schema.json @@ -12,6 +12,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "file": { "type": "string" @@ -59,6 +60,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "val": { "type": "string" @@ -110,6 +112,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "line": { "type": "string" @@ -120,6 +123,12 @@ "literal", "re" ] + }, + "count": { + "type": "integer" + }, + "comment": { + "type": "string" } }, "required": [ -- cgit v1.2.3 From 5da355733113c6d61f22ff74c7e00fc65e01b253 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 22 Jun 2021 23:04:40 +0100 Subject: Fix test.json schema for 'matrix' I'm not sure what the current schema is describing, but it's not doing anything useful to validate 'matrix' entries, as I discover when I come to add something to that. 'matrix' is a dict with possible keys 'options' and 'exclude'. 'options' is a dict with arbitrary keys, whose's values are arrays Once we describe those dicts correctly, also fix that 'val' keys may be string, boolean or null, and the corresponding 'exclude' keys may be string or boolean. v2: Also allow 'val' and 'exclude' to be an array of strings. --- data/test.schema.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'data/test.schema.json') diff --git a/data/test.schema.json b/data/test.schema.json index 43c1392c1..00c52aef6 100644 --- a/data/test.schema.json +++ b/data/test.schema.json @@ -54,16 +54,19 @@ }, "matrix": { "type": "object", - "additionalProperties": { - "properties": { - "options": { + "properties": { + "options": { + "additionalProperties": { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "val": { - "type": "string" + "type": ["string", "boolean", "null", "array"], + "items": { + "type": "string" + } }, "compilers": { "type": "object", @@ -88,7 +91,10 @@ "items": { "type": "object", "additionalProperties": { - "type": "string" + "type": ["string", "boolean", "array"], + "items": { + "type": "string" + } } } } -- cgit v1.2.3