From 04b10bfc853b503ecd0a93a974b4ca8c8a26614b Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:10:40 +0100 Subject: [PATCH 1/2] New: new schema files added to repo --- schema/config.schema.json | 218 ++++++++++++++++++++++++++++++++++++++ schema/course.schema.json | 50 +++++++++ 2 files changed, 268 insertions(+) create mode 100644 schema/config.schema.json create mode 100644 schema/course.schema.json diff --git a/schema/config.schema.json b/schema/config.schema.json new file mode 100644 index 0000000..9a1b3d5 --- /dev/null +++ b/schema/config.schema.json @@ -0,0 +1,218 @@ +{ + "$anchor": "extension-config", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$patch": { + "source": { + "$ref": "config" + }, + "with": { + "properties": { + "_xapi": { + "type": "object", + "title": "xAPI", + "default": {}, + "properties": { + "_isEnabled": { + "type": "boolean", + "title": "Is Enabled", + "description": "Indicates whether this course should send statements to a configured Learning Record Store (LRS).", + "default": true + }, + "_specification": { + "type": "string", + "title": "Specification", + "description": "Indicates whether the plugin should use standard xAPI or cmi5 profile.", + "default": "xAPI", + "enum": [ + "xAPI", + "cmi5" + ], + "_backboneForms": "Select" + }, + "_activityID": { + "type": "string", + "title": "Activity ID", + "description": "Unique identifier for this xAPI activity, i.e. usually the URL to the course.", + "default": "" + }, + "_auID": { + "type": "string", + "title": "Assignable Unit (AU) ID", + "description": "Unique identifier for this assignable unit.", + "default": "1" + }, + "_endpoint": { + "type": "string", + "title": "Endpoint", + "description": "The Learning Record Store (LRS) URL where xAPI statements will be sent to.", + "default": "" + }, + "_user": { + "type": "string", + "title": "User (or Key)", + "description": "The 'user' or 'key' as defined in your Learning Record Store (LRS).", + "default": "" + }, + "_password": { + "type": "string", + "title": "Password (or Secret)", + "description": "The 'password' or 'secret' as defined in your Learning Record Store (LRS).", + "default": "" + }, + "_lang": { + "type": "string", + "title": "Verb language", + "description": "Select the language for verbs to be sent to the LRS.", + "default": "en-US", + "enum": [ + "de-DE", + "en-US", + "fr-FR", + "es-ES" + ], + "_backboneForms": "Select" + }, + "_generateIds": { + "type": "boolean", + "title": "Auto-generate ID for statements", + "description": "When enabled, this will append an auto-generated 'id' value for all xAPI statements. NOTE: It is recommended this is left off so that the LRS will generate the IDs.", + "default": false + }, + "_shouldTrackState": { + "type": "boolean", + "title": "Track state", + "description": "When enabled, the associated LRS be used to track state via the State API.", + "default": true + }, + "_shouldUseRegistration": { + "type": "boolean", + "title": "Use registration", + "description": "When enabled, the registration will be used as part of get/set calls to the State API.", + "default": true + }, + "_componentBlacklist": { + "type": "string", + "title": "Component blacklist", + "description": "Comma separated list of components which will not send statements.", + "default": "blank,graphic" + }, + "_coreEvents": { + "type": "object", + "title": "Core Events", + "default": {}, + "properties": { + "Adapt": { + "type": "object", + "title": "Adapt", + "default": {}, + "properties": { + "router:menu": { + "type": "boolean", + "title": "router:menu", + "description": "Triggered when a menu item is displayed.", + "default": false + }, + "router:page": { + "type": "boolean", + "title": "router:page", + "description": "Triggered when a page is displayed.", + "default": false + }, + "questionView:recordInteraction": { + "type": "boolean", + "title": "questionView:recordInteraction", + "description": "Triggered when a user interacts with a question component.", + "default": true + }, + "assessments:complete": { + "type": "boolean", + "title": "assessments:complete", + "description": "Triggered when an individual assessment is completed.", + "default": true + } + } + }, + "contentObjects": { + "type": "object", + "title": "contentObjects", + "default": {}, + "properties": { + "change:_isComplete": { + "type": "boolean", + "title": "change:_isComplete", + "description": "Triggered when a contentobject, i.e. a page or menu item, is completed.", + "default": false + } + } + }, + "articles": { + "type": "object", + "title": "articles", + "default": {}, + "properties": { + "change:_isComplete": { + "type": "boolean", + "title": "change:_isComplete", + "description": "Triggered when an article is completed.", + "default": false + } + } + }, + "blocks": { + "type": "object", + "title": "blocks", + "default": {}, + "properties": { + "change:_isComplete": { + "type": "boolean", + "title": "change:_isComplete", + "description": "Triggered when a block is completed.", + "default": false + } + } + }, + "components": { + "type": "object", + "title": "components", + "default": {}, + "properties": { + "change:_isComplete": { + "type": "boolean", + "title": "change:_isComplete", + "description": "Triggered when a component is completed.", + "default": true + } + } + } + } + }, + "_lrsFailureBehaviour": { + "type": "string", + "title": "LRS connection failure behaviour", + "description": "Determines how the plugin should behave whenever it fails to successfully connect or send statements to the configured LRS", + "default": "show", + "enum": [ + { + "label": "Ignore errors", + "val": "ignore" + }, + { + "label": "Show errors", + "val": "show" + } + ], + "_backboneForms": "Select" + }, + "_retryConnectionAttempts": { + "type": "number", + "title": "How many attempts should be made to reestablish an LRS connection if disconnected?", + "description": "Indicates how many attempts this course should make to retry initialization or sending state/statements to a configured Learning Record Store (LRS) after a failure.", + "default": 0 + } + } + } + } + } + } +} diff --git a/schema/course.schema.json b/schema/course.schema.json new file mode 100644 index 0000000..ee66a11 --- /dev/null +++ b/schema/course.schema.json @@ -0,0 +1,50 @@ +{ + "$anchor": "extension-course", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$patch": { + "source": { + "$ref": "course" + }, + "with": { + "properties": { + "_globals": { + "type": "object", + "default": {}, + "properties": { + "_extension": { + "type": "object", + "default": {}, + "properties": { + "confirm": { + "type": "string", + "title": "Confirm", + "default": "OK", + "_adapt": { + "translatable": true + } + }, + "lrsConnectionErrorTitle": { + "type": "string", + "title": "LRS connection error title", + "default": "LRS not available", + "_adapt": { + "translatable": true + } + }, + "lrsConnectionErrorMessage": { + "type": "string", + "title": "LRS connection error message", + "default": "We were unable to connect to your Learning Record Store (LRS). This means that your progress cannot be recorded.", + "_adapt": { + "translatable": true + } + } + } + } + } + } + } + } + } +} From 6114ef29c4915ea388ae4db762935669233a5ce7 Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:07:48 +0100 Subject: [PATCH 2/2] add title for globals, correct enum --- schema/config.schema.json | 10 ++------ schema/course.schema.json | 50 ++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/schema/config.schema.json b/schema/config.schema.json index 9a1b3d5..5755a4c 100644 --- a/schema/config.schema.json +++ b/schema/config.schema.json @@ -193,14 +193,8 @@ "description": "Determines how the plugin should behave whenever it fails to successfully connect or send statements to the configured LRS", "default": "show", "enum": [ - { - "label": "Ignore errors", - "val": "ignore" - }, - { - "label": "Show errors", - "val": "show" - } + "ignore", + "show" ], "_backboneForms": "Select" }, diff --git a/schema/course.schema.json b/schema/course.schema.json index ee66a11..dd7400c 100644 --- a/schema/course.schema.json +++ b/schema/course.schema.json @@ -16,28 +16,34 @@ "type": "object", "default": {}, "properties": { - "confirm": { - "type": "string", - "title": "Confirm", - "default": "OK", - "_adapt": { - "translatable": true - } - }, - "lrsConnectionErrorTitle": { - "type": "string", - "title": "LRS connection error title", - "default": "LRS not available", - "_adapt": { - "translatable": true - } - }, - "lrsConnectionErrorMessage": { - "type": "string", - "title": "LRS connection error message", - "default": "We were unable to connect to your Learning Record Store (LRS). This means that your progress cannot be recorded.", - "_adapt": { - "translatable": true + "_xapi": { + "type": "object", + "title": "xAPI", + "properties": { + "confirm": { + "type": "string", + "title": "Confirm", + "default": "OK", + "_adapt": { + "translatable": true + } + }, + "lrsConnectionErrorTitle": { + "type": "string", + "title": "LRS connection error title", + "default": "LRS not available", + "_adapt": { + "translatable": true + } + }, + "lrsConnectionErrorMessage": { + "type": "string", + "title": "LRS connection error message", + "default": "We were unable to connect to your Learning Record Store (LRS). This means that your progress cannot be recorded.", + "_adapt": { + "translatable": true + } + } } } }