From dd2702a6dcb457753576801a704713e91efa664f Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 10:17:15 -0700 Subject: [PATCH 1/5] [53] Add test IDs This adds IDs for individual tests and for sets of tests. --- test-schema.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test-schema.json b/test-schema.json index 670d2804..907827d8 100644 --- a/test-schema.json +++ b/test-schema.json @@ -27,6 +27,11 @@ "type": "object", "required": ["description", "schema", "tests"], "properties": { + "id": { + "description": "Uniquely identifies a set of tests", + "type": "string", + "format": "uri" + }, "description": {"type": "string"}, "schema": {}, "tests": { @@ -35,6 +40,11 @@ "type": "object", "required": ["description", "data", "valid"], "properties": { + "id": { + "description": "Uniquely identifies a single test", + "type": "string", + "format": "uri" + }, "description": {"type": "string"}, "data": {}, "valid": {"type": "boolean"}, From b2dad58ac4ad8b4a63232b3b84d9bafdfdc74533 Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 10:20:06 -0700 Subject: [PATCH 2/5] Refactor a single test into the "definitions" area --- test-schema.json | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/test-schema.json b/test-schema.json index 907827d8..68887736 100644 --- a/test-schema.json +++ b/test-schema.json @@ -20,6 +20,30 @@ "items": {"$ref": "#/definitions/outputItem"} } } + }, + "test": { + "type": "object", + "required": ["description", "data", "valid"], + "properties": { + "id": { + "description": "Uniquely identifies a single test", + "type": "string", + "format": "uri" + }, + "description": {"type": "string"}, + "data": {}, + "valid": {"type": "boolean"}, + "output": { + "type": "object", + "properties": { + "basic": {"$ref": "#/definitions/outputItem"}, + "detailed": {"$ref": "#/definitions/outputItem"}, + "verbose": {"$ref": "#/definitions/outputItem"} + }, + "required": ["basic", "detailed", "verbose"] + } + }, + "additionalProperties": false } }, "type": "array", @@ -36,30 +60,7 @@ "schema": {}, "tests": { "type": "array", - "items": { - "type": "object", - "required": ["description", "data", "valid"], - "properties": { - "id": { - "description": "Uniquely identifies a single test", - "type": "string", - "format": "uri" - }, - "description": {"type": "string"}, - "data": {}, - "valid": {"type": "boolean"}, - "output": { - "type": "object", - "properties": { - "basic": {"$ref": "#/definitions/outputItem"}, - "detailed": {"$ref": "#/definitions/outputItem"}, - "verbose": {"$ref": "#/definitions/outputItem"} - }, - "required": ["basic", "detailed", "verbose"] - } - }, - "additionalProperties": false - }, + "items": { "$ref": "#/definitions/test" }, "minItems": 1 } }, From 62c4851d701277d5a0fc6a1f9bfb6b668c5c9c7d Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 10:31:37 -0700 Subject: [PATCH 3/5] Add some description annotations --- test-schema.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-schema.json b/test-schema.json index 68887736..efb78408 100644 --- a/test-schema.json +++ b/test-schema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Schema for tests", "definitions": { "outputItem": { "type": "object", @@ -22,6 +23,7 @@ } }, "test": { + "description": "A single test", "type": "object", "required": ["description", "data", "valid"], "properties": { @@ -59,6 +61,7 @@ "description": {"type": "string"}, "schema": {}, "tests": { + "description": "A set of related tests all using the same schema", "type": "array", "items": { "$ref": "#/definitions/test" }, "minItems": 1 From 48cec8fac4fbac01383b5ecb1fceb643116e6303 Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 10:33:23 -0700 Subject: [PATCH 4/5] Clean up some spacing --- test-schema.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test-schema.json b/test-schema.json index efb78408..9b2958f8 100644 --- a/test-schema.json +++ b/test-schema.json @@ -5,44 +5,44 @@ "outputItem": { "type": "object", "properties": { - "valid": {"type": "boolean"}, - "keywordLocation": {"type": "string"}, + "valid": { "type": "boolean" }, + "keywordLocation": { "type": "string" }, "absoluteKeywordLocation": { "type": "string", "format": "uri" }, - "instanceLocation": {"type": "string"}, + "instanceLocation": { "type": "string" }, "annotations": { "type": "array", - "items": {"$ref": "#/definitions/outputItem"} + "items": { "$ref": "#/definitions/outputItem" } }, "errors": { "type": "array", - "items": {"$ref": "#/definitions/outputItem"} + "items": { "$ref": "#/definitions/outputItem" } } } }, "test": { "description": "A single test", "type": "object", - "required": ["description", "data", "valid"], + "required": [ "description", "data", "valid" ], "properties": { "id": { "description": "Uniquely identifies a single test", "type": "string", "format": "uri" }, - "description": {"type": "string"}, + "description": { "type": "string" }, "data": {}, - "valid": {"type": "boolean"}, + "valid": { "type": "boolean" }, "output": { "type": "object", + "required": [ "basic", "detailed", "verbose" ], "properties": { - "basic": {"$ref": "#/definitions/outputItem"}, - "detailed": {"$ref": "#/definitions/outputItem"}, - "verbose": {"$ref": "#/definitions/outputItem"} - }, - "required": ["basic", "detailed", "verbose"] + "basic": { "$ref": "#/definitions/outputItem" }, + "detailed": { "$ref": "#/definitions/outputItem" }, + "verbose": { "$ref": "#/definitions/outputItem" } + } } }, "additionalProperties": false @@ -51,14 +51,14 @@ "type": "array", "items": { "type": "object", - "required": ["description", "schema", "tests"], + "required": [ "description", "schema", "tests" ], "properties": { "id": { "description": "Uniquely identifies a set of tests", "type": "string", "format": "uri" }, - "description": {"type": "string"}, + "description": { "type": "string" }, "schema": {}, "tests": { "description": "A set of related tests all using the same schema", From 40e806a4fe6a4da07dd59b0e938727915bdc7b9e Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 10:34:18 -0700 Subject: [PATCH 5/5] Move the "definitions" area below the main schema part This is for readability---the main schema description is now the first thing we read, details follow. --- test-schema.json | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test-schema.json b/test-schema.json index 9b2958f8..8393720d 100644 --- a/test-schema.json +++ b/test-schema.json @@ -1,6 +1,28 @@ { "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for tests", + "type": "array", + "items": { + "type": "object", + "required": [ "description", "schema", "tests" ], + "properties": { + "id": { + "description": "Uniquely identifies a set of tests", + "type": "string", + "format": "uri" + }, + "description": { "type": "string" }, + "schema": {}, + "tests": { + "description": "A set of related tests all using the same schema", + "type": "array", + "items": { "$ref": "#/definitions/test" }, + "minItems": 1 + } + }, + "additionalProperties": false, + "minItems": 1 + }, "definitions": { "outputItem": { "type": "object", @@ -47,27 +69,5 @@ }, "additionalProperties": false } - }, - "type": "array", - "items": { - "type": "object", - "required": [ "description", "schema", "tests" ], - "properties": { - "id": { - "description": "Uniquely identifies a set of tests", - "type": "string", - "format": "uri" - }, - "description": { "type": "string" }, - "schema": {}, - "tests": { - "description": "A set of related tests all using the same schema", - "type": "array", - "items": { "$ref": "#/definitions/test" }, - "minItems": 1 - } - }, - "additionalProperties": false, - "minItems": 1 } }