From 16c5f4883c7a84d459c35fc0a096426d9e1ae346 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Wed, 30 Aug 2023 20:24:44 -0700 Subject: [PATCH 01/13] feat: add ConsistencyChecks schemas --- .../has_consistency_checks.json | 13 +++++++ schema/system/consistency_checks.json | 39 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 schema/in_memory_entity/has_consistency_checks.json create mode 100644 schema/system/consistency_checks.json diff --git a/schema/in_memory_entity/has_consistency_checks.json b/schema/in_memory_entity/has_consistency_checks.json new file mode 100644 index 000000000..507cd4a2c --- /dev/null +++ b/schema/in_memory_entity/has_consistency_checks.json @@ -0,0 +1,13 @@ +{ + "$id": "in-memory-entity/has-consistency-checks", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Has consistency checks", + "allOf": [ + { + "$ref": "base.json" + }, + { + "$ref": "../system/consistency_checks.json" + } + ] +} \ No newline at end of file diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json new file mode 100644 index 000000000..5b5860ea6 --- /dev/null +++ b/schema/system/consistency_checks.json @@ -0,0 +1,39 @@ +{ + "$id": "system/consistency-checks", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "consistency checks schema", + "properties": { + "consistency_checks": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "severity": { + "enum": ["info", "warning", "error"] + }, + "arguments": { + "type": "object" + }, + "message": { + "type": "string" + }, + "enabled": { + "type": "boolean" + } + }, + "required": [ + "name", + "severity", + "arguments", + "message" + ] + } + } + } +} \ No newline at end of file From af2beec1249e566eaae98302d098977686a62d7b Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:27:05 -0700 Subject: [PATCH 02/13] update: refine checks schema --- schema/system/consistency_checks.json | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index 5b5860ea6..b915754a3 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -9,28 +9,36 @@ "type": "object", "properties": { "name": { - "type": "string" + "type": "string", + "description": "Name of the consistency check which comes from an exported enum." }, "description": { - "type": "string" + "type": "string", + "description": "Description of the consistency check provided for developers." }, - "severity": { - "enum": ["info", "warning", "error"] + "keys": { + "type": "array", + "items": {} }, "arguments": { - "type": "object" + "type": "array", + "items": { + "type": "object" + }, + "description": "Arguments provided by consistency check function for message construction, specific to each check." + }, + "severity": { + "enum": ["info", "warning", "error"] }, "message": { "type": "string" - }, - "enabled": { - "type": "boolean" } }, "required": [ "name", - "severity", + "keys", "arguments", + "severity", "message" ] } From 2b3357cebe897169f91b023570fb7ec9f190237f Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:34:01 -0700 Subject: [PATCH 03/13] update: fix small issue --- schema/in_memory_entity/has_consistency_checks.json | 2 +- schema/system/consistency_checks.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/in_memory_entity/has_consistency_checks.json b/schema/in_memory_entity/has_consistency_checks.json index 507cd4a2c..f141a3160 100644 --- a/schema/in_memory_entity/has_consistency_checks.json +++ b/schema/in_memory_entity/has_consistency_checks.json @@ -10,4 +10,4 @@ "$ref": "../system/consistency_checks.json" } ] -} \ No newline at end of file +} diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index b915754a3..6d7a26aa9 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -44,4 +44,4 @@ } } } -} \ No newline at end of file +} From ec448b0a57f0a47bb51d3a277a328bff68fbecb3 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:10:11 -0700 Subject: [PATCH 04/13] update: change schema as per discussion with TB --- schema/system/consistency_checks.json | 45 +++++++++++++-------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index 6d7a26aa9..97cc02cf4 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -8,38 +8,37 @@ "items": { "type": "object", "properties": { - "name": { - "type": "string", - "description": "Name of the consistency check which comes from an exported enum." - }, - "description": { - "type": "string", - "description": "Description of the consistency check provided for developers." - }, "keys": { "type": "array", - "items": {} + "items": { + "type": "string" + } }, - "arguments": { + "messages": { "type": "array", "items": { - "type": "object" - }, - "description": "Arguments provided by consistency check function for message construction, specific to each check." - }, - "severity": { - "enum": ["info", "warning", "error"] - }, - "message": { - "type": "string" + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "checkName": { + "type": "string", + "description": "Name of the consistency check which comes from an exported enum." + }, + "severity": { + "enum": ["info", "warning", "error"] + }, + "message": { + "type": "string" + } + } + } } }, "required": [ - "name", "keys", - "arguments", - "severity", - "message" + "messages" ] } } From 9224c05609c00c5dd243ccdd028c3ab3eae2d1c3 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:58:44 -0700 Subject: [PATCH 05/13] update: make all properties required --- schema/system/consistency_checks.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index 97cc02cf4..2c4582d1b 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -33,7 +33,13 @@ "type": "string" } } - } + }, + "required": [ + "key", + "checkName", + "severity", + "message" + ] } }, "required": [ From e3f8f6cdd71c08c7a3c2e700b6d41a29329005b4 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Tue, 5 Sep 2023 15:16:38 -0700 Subject: [PATCH 06/13] update: redefine CChecks as one object --- schema/system/consistency_checks.json | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index 2c4582d1b..ee1ae2e85 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -1,13 +1,8 @@ { "$id": "system/consistency-checks", "$schema": "http://json-schema.org/draft-04/schema#", - "title": "consistency checks schema", - "properties": { - "consistency_checks": { - "type": "array", - "items": { - "type": "object", - "properties": { + "title": "consistency checks", + "properties": { "keys": { "type": "array", "items": { @@ -32,21 +27,18 @@ "message": { "type": "string" } - } - }, - "required": [ - "key", - "checkName", - "severity", - "message" - ] + }, + "required": [ + "key", + "checkName", + "severity", + "message" + ] + } } }, - "required": [ - "keys", - "messages" - ] - } + "required": [ + "keys", + "messages" + ] } - } -} From 5c98cd1a80022693f893950e6d1dc8d4895d0c73 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:30:52 -0700 Subject: [PATCH 07/13] update: perform lint:fix and change check names type to enum --- .../has_consistency_checks.json | 22 +++--- schema/system/consistency_checks.json | 74 ++++++++++--------- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/schema/in_memory_entity/has_consistency_checks.json b/schema/in_memory_entity/has_consistency_checks.json index f141a3160..257c694e5 100644 --- a/schema/in_memory_entity/has_consistency_checks.json +++ b/schema/in_memory_entity/has_consistency_checks.json @@ -1,13 +1,13 @@ { - "$id": "in-memory-entity/has-consistency-checks", - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Has consistency checks", - "allOf": [ - { - "$ref": "base.json" - }, - { - "$ref": "../system/consistency_checks.json" - } - ] + "$id": "in-memory-entity/has-consistency-checks", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Has consistency checks", + "allOf": [ + { + "$ref": "base.json" + }, + { + "$ref": "../system/consistency_checks.json" + } + ] } diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index ee1ae2e85..acf5517e6 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -1,44 +1,50 @@ { - "$id": "system/consistency-checks", - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "consistency checks", - "properties": { - "keys": { + "$id": "system/consistency-checks", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "consistency checks", + "properties": { + "keys": { "type": "array", "items": { - "type": "string" + "type": "string" } - }, - "messages": { + }, + "messages": { "type": "array", "items": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "checkName": { - "type": "string", - "description": "Name of the consistency check which comes from an exported enum." + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "checkName": { + "enum": [ + "atomsTooClose" + ], + "description": "Name of the consistency check which is exported as an enum" + }, + "severity": { + "enum": [ + "info", + "warning", + "error" + ] + }, + "message": { + "type": "string" + } }, - "severity": { - "enum": ["info", "warning", "error"] - }, - "message": { - "type": "string" - } - }, - "required": [ - "key", - "checkName", - "severity", - "message" - ] + "required": [ + "key", + "checkName", + "severity", + "message" + ] } - } - }, - "required": [ + } + }, + "required": [ "keys", "messages" - ] - } + ] +} From c9a389e30e43adb19c9e5e95e3bc5e7766a47639 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:00:45 -0700 Subject: [PATCH 08/13] update: add default to enum --- schema/system/consistency_checks.json | 1 + 1 file changed, 1 insertion(+) diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json index acf5517e6..5831425b1 100644 --- a/schema/system/consistency_checks.json +++ b/schema/system/consistency_checks.json @@ -19,6 +19,7 @@ }, "checkName": { "enum": [ + "default", "atomsTooClose" ], "description": "Name of the consistency check which is exported as an enum" From 0ae1c426c405d312a879919ffb8889cf68fce975 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:37:14 -0700 Subject: [PATCH 09/13] update: isolate singular CCheck definition and ref in in_memory_entity --- schema/in_memory_entity/base.json | 7 +++ .../has_consistency_checks.json | 13 ----- schema/system/consistency_check.json | 0 schema/system/consistency_checks.json | 51 ------------------- 4 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 schema/in_memory_entity/has_consistency_checks.json create mode 100644 schema/system/consistency_check.json delete mode 100644 schema/system/consistency_checks.json diff --git a/schema/in_memory_entity/base.json b/schema/in_memory_entity/base.json index 05d890942..6f7f0c7ac 100644 --- a/schema/in_memory_entity/base.json +++ b/schema/in_memory_entity/base.json @@ -19,6 +19,13 @@ }, "systemName": { "type": "string" + }, + "consistency_checks": { + "type": "array", + "items": { + "type": "object", + "$ref": "../system/consistency_check.json" + } } } } diff --git a/schema/in_memory_entity/has_consistency_checks.json b/schema/in_memory_entity/has_consistency_checks.json deleted file mode 100644 index 257c694e5..000000000 --- a/schema/in_memory_entity/has_consistency_checks.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$id": "in-memory-entity/has-consistency-checks", - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Has consistency checks", - "allOf": [ - { - "$ref": "base.json" - }, - { - "$ref": "../system/consistency_checks.json" - } - ] -} diff --git a/schema/system/consistency_check.json b/schema/system/consistency_check.json new file mode 100644 index 000000000..e69de29bb diff --git a/schema/system/consistency_checks.json b/schema/system/consistency_checks.json deleted file mode 100644 index 5831425b1..000000000 --- a/schema/system/consistency_checks.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "$id": "system/consistency-checks", - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "consistency checks", - "properties": { - "keys": { - "type": "array", - "items": { - "type": "string" - } - }, - "messages": { - "type": "array", - "items": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "checkName": { - "enum": [ - "default", - "atomsTooClose" - ], - "description": "Name of the consistency check which is exported as an enum" - }, - "severity": { - "enum": [ - "info", - "warning", - "error" - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "key", - "checkName", - "severity", - "message" - ] - } - } - }, - "required": [ - "keys", - "messages" - ] -} From 21fc9b7290801e643b55a3f6ec0f5623a11a25fc Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:46:30 -0700 Subject: [PATCH 10/13] update: add consistecny check schema --- schema/system/consistency_check.json | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/schema/system/consistency_check.json b/schema/system/consistency_check.json index e69de29bb..3c191a5ba 100644 --- a/schema/system/consistency_check.json +++ b/schema/system/consistency_check.json @@ -0,0 +1,37 @@ +{ + "$id": "system/consistency-check", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "consistency check", + "consistency_check": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "Key of the property of the entity on which the consistency check is performed, e.g. 'basis.coordinates.1'" + }, + "name": { + "enum": [ + "default", + "atomsTooClose" + ], + "description": "Name of the consistency check which is exported as an enum" + }, + "severity": { + "enum": [ + "info", + "warning", + "error" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "key", + "name", + "severity", + "message" + ] + } +} From 0ff6045abf495344a92bbb97214230147aadb6fb Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 20 Oct 2023 22:40:41 -0700 Subject: [PATCH 11/13] fix: error with reference --- schema/in_memory_entity/base.json | 1 - schema/system/consistency_check.json | 60 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/schema/in_memory_entity/base.json b/schema/in_memory_entity/base.json index 6f7f0c7ac..d33e7dd7c 100644 --- a/schema/in_memory_entity/base.json +++ b/schema/in_memory_entity/base.json @@ -23,7 +23,6 @@ "consistency_checks": { "type": "array", "items": { - "type": "object", "$ref": "../system/consistency_check.json" } } diff --git a/schema/system/consistency_check.json b/schema/system/consistency_check.json index 3c191a5ba..e314823aa 100644 --- a/schema/system/consistency_check.json +++ b/schema/system/consistency_check.json @@ -2,36 +2,34 @@ "$id": "system/consistency-check", "$schema": "http://json-schema.org/draft-04/schema#", "title": "consistency check", - "consistency_check": { - "type": "object", - "properties": { - "key": { - "type": "string", - "description": "Key of the property of the entity on which the consistency check is performed, e.g. 'basis.coordinates.1'" - }, - "name": { - "enum": [ - "default", - "atomsTooClose" - ], - "description": "Name of the consistency check which is exported as an enum" - }, - "severity": { - "enum": [ - "info", - "warning", - "error" - ] - }, - "message": { - "type": "string" - } + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "Key of the property of the entity on which the consistency check is performed, e.g. 'basis.coordinates.1'" }, - "required": [ - "key", - "name", - "severity", - "message" - ] - } + "name": { + "enum": [ + "default", + "atomsTooClose" + ], + "description": "Name of the consistency check which is exported as an enum" + }, + "severity": { + "enum": [ + "info", + "warning", + "error" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "key", + "name", + "severity", + "message" + ] } From 19d14ec8240fb7a9ef31cb6a460bbcc3bcda09d4 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:51:53 -0700 Subject: [PATCH 12/13] update: add description --- schema/in_memory_entity/base.json | 2 +- schema/system/consistency_check.json | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/schema/in_memory_entity/base.json b/schema/in_memory_entity/base.json index d33e7dd7c..9de7a7a8c 100644 --- a/schema/in_memory_entity/base.json +++ b/schema/in_memory_entity/base.json @@ -20,7 +20,7 @@ "systemName": { "type": "string" }, - "consistency_checks": { + "consistencyChecks": { "type": "array", "items": { "$ref": "../system/consistency_check.json" diff --git a/schema/system/consistency_check.json b/schema/system/consistency_check.json index e314823aa..7792aaedc 100644 --- a/schema/system/consistency_check.json +++ b/schema/system/consistency_check.json @@ -3,27 +3,30 @@ "$schema": "http://json-schema.org/draft-04/schema#", "title": "consistency check", "type": "object", + "description": "The output of consistency checks performed on data adhering to JSON schema, but inconsistent with scientific or logical rules, to show problems in UI.", "properties": { "key": { "type": "string", - "description": "Key of the property of the entity on which the consistency check is performed, e.g. 'basis.coordinates.1'" + "description": "Key of the property of the entity on which the consistency check is performed in Mongo dot notation, e.g. 'basis.coordinates.1'" }, "name": { "enum": [ "default", "atomsTooClose" ], - "description": "Name of the consistency check which is exported as an enum" + "description": "Name of the consistency check that is performed, which is listed in an enum." }, "severity": { "enum": [ "info", "warning", "error" - ] + ], + "description": "Severity level of the problem, which is used in UI to differentiate." }, "message": { - "type": "string" + "type": "string", + "description": "Message generated by the consistency check describing the problem." } }, "required": [ From 3e7805a3707b9d1c9670c4d6573048ac403235fa Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 27 Oct 2023 13:41:06 -0700 Subject: [PATCH 13/13] update: add example for CCheck --- example/system/consistency_check.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 example/system/consistency_check.json diff --git a/example/system/consistency_check.json b/example/system/consistency_check.json new file mode 100644 index 000000000..78632ba17 --- /dev/null +++ b/example/system/consistency_check.json @@ -0,0 +1,6 @@ +{ + "key": "basis.coordinates.0", + "name": "atomsTooClose", + "severity": "warning", + "message": "Atom 0 is too close to atom X" +}