From 46e519990b117da34d9b14780b01206797162792 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Fri, 3 Feb 2023 11:00:08 +0000 Subject: [PATCH 1/2] Remove schema duplication --- schema/article.schema.json | 14 ++------------ schema/block.schema.json | 11 +---------- schema/component.schema.json | 22 ++++++++++++++++++---- schema/contentcontainer.schema.json | 23 +++++++++++++++++++++++ schema/contentobject.schema.json | 11 +---------- schema/course.schema.json | 28 +--------------------------- 6 files changed, 46 insertions(+), 63 deletions(-) create mode 100644 schema/contentcontainer.schema.json diff --git a/schema/article.schema.json b/schema/article.schema.json index b2bab240..c60745ec 100644 --- a/schema/article.schema.json +++ b/schema/article.schema.json @@ -4,20 +4,10 @@ "type": "object", "$merge": { "source": { - "$ref": "content" + "$ref": "contentcontainer" }, "with": { - "properties": { - "_requireCompletionOf": { - "type": "number", - "title": "Number of blocks required for completion", - "description": "The number of blocks within this article the learner must complete in order for this article to be set as completed. A value of -1 requires all of them to be completed", - "default": -1, - "_adapt": { - "isSetting": true - } - } - } + "properties": {} } } } diff --git a/schema/block.schema.json b/schema/block.schema.json index 678502b9..d7b14413 100644 --- a/schema/block.schema.json +++ b/schema/block.schema.json @@ -4,7 +4,7 @@ "type": "object", "$merge": { "source": { - "$ref": "content" + "$ref": "contentcontainer" }, "with": { "properties": { @@ -20,15 +20,6 @@ "_adapt": { "editorOnly": true } - }, - "_requireCompletionOf": { - "type": "number", - "title": "Number of components required for completion", - "description": "The number of components within this block the learner must complete in order for this block to be set as completed. A value of -1 requires all of them to be completed", - "default": -1, - "_adapt": { - "isSetting": true - } } } } diff --git a/schema/component.schema.json b/schema/component.schema.json index d633d838..5ffe08d5 100644 --- a/schema/component.schema.json +++ b/schema/component.schema.json @@ -15,6 +15,19 @@ "type": "string", "title": "Component" }, + "_supportedLayout": { + "type": "string", + "title": "Supported layout", + "default": "both", + "enum": [ + "full-width", + "half-width", + "both" + ], + "_adapt": { + "editorOnly": true + } + }, "_layout": { "type": "string", "title": "Layout", @@ -44,10 +57,11 @@ "isSetting": true } }, - "properties": { - "type": "object", - "title": "Properties", - "default": {} + "tags": { + "type": "string", + "_backboneForms": { + "showInUi": false + } } } } diff --git a/schema/contentcontainer.schema.json b/schema/contentcontainer.schema.json new file mode 100644 index 00000000..db497a8c --- /dev/null +++ b/schema/contentcontainer.schema.json @@ -0,0 +1,23 @@ +{ + "$anchor": "contentcontainer", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$merge": { + "source": { + "$ref": "content" + }, + "with": { + "properties": { + "_requireCompletionOf": { + "type": "number", + "title": "Number of child content objects required for completion", + "description": "The number of child content objects the learner must complete in order for this item to be set as completed. A value of -1 requires all of them to be completed", + "default": -1, + "_adapt": { + "isSetting": true + } + } + } + } + } +} diff --git a/schema/contentobject.schema.json b/schema/contentobject.schema.json index 37d6e821..3787e095 100644 --- a/schema/contentobject.schema.json +++ b/schema/contentobject.schema.json @@ -4,7 +4,7 @@ "type": "object", "$merge": { "source": { - "$ref": "content" + "$ref": "contentcontainer" }, "with": { "properties": { @@ -96,15 +96,6 @@ ], "_backboneForms": "Select" }, - "_requireCompletionOf": { - "type": "number", - "title": "Number of articles required for completion", - "description": "The number of articles within this page the learner must complete in order for this page to be set as completed. A value of -1 requires all of them to be completed", - "default": -1, - "_adapt": { - "isSetting": true - } - }, "menuSettings": { "type": "object", "title": "Menu settings", diff --git a/schema/course.schema.json b/schema/course.schema.json index 18bd8a72..5489a6a5 100644 --- a/schema/course.schema.json +++ b/schema/course.schema.json @@ -4,7 +4,7 @@ "type": "object", "$merge": { "source": { - "$ref": "content" + "$ref": "contentcontainer" }, "with": { "properties": { @@ -316,7 +316,6 @@ "_navOrder": { "type": "number", "title": "Navigation bar order", - "description": "Determines the order in which the object is displayed in the navigation bar. Negative numbers (e.g. -100) are left-aligned. Positive numbers (e.g. 100) are right-aligned.", "default": 100 } } @@ -334,7 +333,6 @@ "_navOrder": { "type": "number", "title": "Navigation bar order", - "description": "Determines the order in which the object is displayed in the navigation bar. Negative numbers (e.g. -100) are left-aligned. Positive numbers (e.g. 100) are right-aligned.", "default": -100 } } @@ -347,7 +345,6 @@ "_navOrder": { "type": "number", "title": "Navigation bar order", - "description": "Determines the order in which the object is displayed in the navigation bar. Negative numbers (e.g. -100) are left-aligned. Positive numbers (e.g. 100) are right-aligned.", "default": 0 } } @@ -366,7 +363,6 @@ "_navOrder": { "type": "number", "title": "Navigation bar order", - "description": "Determines the order in which the object is displayed in the navigation bar. Negative numbers (e.g. -100) are left-aligned. Positive numbers (e.g. 100) are right-aligned.", "default": 0 } } @@ -585,28 +581,6 @@ } } }, - "tags": { - "type": "array", - "title": "Tags", - "description": "Add tags to your course by entering one or more words, separated with a comma (,)", - "items": { - "type": "string", - "isObjectId": true - }, - "_adapt": { - "editorOnly": true - }, - "_backboneForms": "Tags" - }, - "_requireCompletionOf": { - "type": "number", - "title": "Number of pages/submenus required for completion", - "description": "The number of content objects within this course the learner must complete in order for this course to be set as completed. A value of -1 requires all of them to be completed", - "default": -1, - "_adapt": { - "isSetting": true - } - }, "_isSelected": { "type": "boolean", "title": "Is selected", From a65d33445162d5b5f2d1028bae49bf44d57abe13 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Fri, 3 Feb 2023 17:59:24 +0000 Subject: [PATCH 2/2] Update tags type --- schema/component.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/component.schema.json b/schema/component.schema.json index 5ffe08d5..ba638a86 100644 --- a/schema/component.schema.json +++ b/schema/component.schema.json @@ -58,7 +58,7 @@ } }, "tags": { - "type": "string", + "type": "array", "_backboneForms": { "showInUi": false }