From 161700d1b207fd7383f96c6c66f0c9fb5b4ec1d8 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Tue, 2 Sep 2025 18:54:59 +0100 Subject: [PATCH 1/3] Add question schemas --- schema/items-question-component.schema.json | 28 ++ schema/question-component.schema.json | 305 ++++++++++++++++++++ 2 files changed, 333 insertions(+) create mode 100644 schema/items-question-component.schema.json create mode 100644 schema/question-component.schema.json diff --git a/schema/items-question-component.schema.json b/schema/items-question-component.schema.json new file mode 100644 index 00000000..d9ef76f7 --- /dev/null +++ b/schema/items-question-component.schema.json @@ -0,0 +1,28 @@ +{ + "$anchor": "items-question-component", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$merge": { + "source": { + "$ref": "question-component" + }, + "with": { + "required": [ + ], + "properties": { + "_items": { + "type": "array", + "title": "Items", + "items": { + "type": "object" + } + }, + "_isRandom": { + "type": "boolean", + "title": "Randomise answers", + "default": false + } + } + } + } +} diff --git a/schema/question-component.schema.json b/schema/question-component.schema.json new file mode 100644 index 00000000..8c25621a --- /dev/null +++ b/schema/question-component.schema.json @@ -0,0 +1,305 @@ +{ + "$anchor": "question-component", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$merge": { + "source": { + "$ref": "component" + }, + "with": { + "required": [ + ], + "properties": { + "instruction": { + "type": "string", + "title": "Instruction", + "default": "Choose {{#if _isRadio}}one option{{else}}one or more options{{/if}} then select Submit.", + "_adapt": { + "translatable": true + } + }, + "ariaQuestion": { + "type": "string", + "title": "ARIA question", + "description": "This will be read out by screen readers instead of reading the 'Display title', 'Body' & 'Instruction' fields when focusing on the options. To be clear and concise, ensure the text encompasses only the question associated.", + "default": "", + "_adapt": { + "translatable": true + } + }, + "_attempts": { + "type": "number", + "title": "Allowed attempts", + "description": "How many attempts the learner is allowed", + "default": 1 + }, + "_canShowModelAnswer": { + "type": "boolean", + "title": "Enable correct answer toggle", + "description": "Allow the user to view the 'model answer' if they answer the question incorrectly", + "default": true + }, + "_canShowCorrectness": { + "type": "boolean", + "title": "Enable items to display correctness", + "description": "If enabled, this replaces the associated 'model answer' toggle button and displays correctness directly on the component items.", + "default": false + }, + "_canShowFeedback": { + "type": "boolean", + "title": "Enable feedback", + "default": true + }, + "_canShowMarking": { + "type": "boolean", + "title": "Enable marking", + "default": true + }, + "_shouldDisplayAttempts": { + "type": "boolean", + "title": "Show number of remaining attempts", + "default": false + }, + "_questionWeight": { + "type": "number", + "title": "Question weight", + "description": "When item scoring is disabled, this is the question score for a correct response", + "default": 1 + }, + "_recordInteraction": { + "type": "boolean", + "title": "Record interaction", + "description": "If disabled, recording the user's answer(s) to this question to cmi.interactions on the LMS will be disabled for this component only", + "default": true + }, + "_feedback": { + "type": "object", + "title": "Feedback", + "default": {}, + "properties": { + "title": { + "type": "string", + "title": "Title", + "description": "Title text for the feedback", + "default": "", + "_adapt": { + "translatable": true + } + }, + "altTitle": { + "type": "string", + "title": "Alternative Feedback Title", + "description": "Text read out by screen readers if no visual title is included", + "default": "", + "_adapt": { + "translatable": true + } + }, + "correct": { + "type": "string", + "title": "Correct", + "description": "Correct answer feedback for this question", + "default": "", + "_adapt": { + "translatable": true + }, + "_backboneForms": "TextArea" + }, + "_incorrect": { + "type": "object", + "title": "Incorrect", + "default": {}, + "properties": { + "final": { + "type": "string", + "title": "Default incorrect feedback", + "description": "Incorrect answer feedback for the final attempt", + "default": "", + "_adapt": { + "translatable": true + }, + "_backboneForms": "TextArea" + }, + "notFinal": { + "type": "string", + "title": "Retry feedback", + "description": "Incorrect answer feedback for any attempt apart from the last attempt. If you leave this blank, the default incorrect feedback will be used instead", + "default": "", + "_adapt": { + "translatable": true + }, + "_backboneForms": "TextArea" + } + } + }, + "_partlyCorrect": { + "type": "object", + "title": "Partly correct", + "default": {}, + "properties": { + "final": { + "type": "string", + "title": "Default partly correct feedback", + "description": "Partly correct answer feedback for the final attempt. If you leave this blank, the default incorrect feedback will be used instead", + "default": "", + "_adapt": { + "translatable": true + }, + "_backboneForms": "TextArea" + }, + "notFinal": { + "type": "string", + "title": "Retry feedback", + "description": "Partly correct answer feedback for any attempt apart from the last attempt. If you leave this blank, the default partly correct feedback will be used instead", + "default": "", + "_adapt": { + "translatable": true + }, + "_backboneForms": "TextArea" + } + } + } + } + }, + "_buttons": { + "type": "object", + "title": "Button overrides", + "default": {}, + "properties": { + "_submit": { + "type": "object", + "title": "Submit", + "default": {}, + "properties": { + "buttonText": { + "type": "string", + "title": "Button text", + "default": "", + "_adapt": { + "translatable": true + } + }, + "ariaLabel": { + "type": "string", + "title": "ARIA label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + }, + "_reset": { + "type": "object", + "title": "Reset", + "default": {}, + "properties": { + "buttonText": { + "type": "string", + "title": "Button text", + "default": "", + "_adapt": { + "translatable": true + } + }, + "ariaLabel": { + "type": "string", + "title": "ARIA label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + }, + "_showCorrectAnswer": { + "type": "object", + "title": "Show correct answer", + "default": {}, + "properties": { + "buttonText": { + "type": "string", + "title": "Button text", + "default": "", + "_adapt": { + "translatable": true + } + }, + "ariaLabel": { + "type": "string", + "title": "ARIA label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + }, + "_hideCorrectAnswer": { + "type": "object", + "title": "Hide correct answer", + "default": {}, + "properties": { + "buttonText": { + "type": "string", + "title": "Button text", + "default": "", + "_adapt": { + "translatable": true + } + }, + "ariaLabel": { + "type": "string", + "title": "ARIA label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + }, + "_showFeedback": { + "type": "object", + "title": "Show feedback", + "default": {}, + "properties": { + "buttonText": { + "type": "string", + "title": "Button text", + "default": "", + "_adapt": { + "translatable": true + } + }, + "ariaLabel": { + "type": "string", + "title": "ARIA label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + }, + "remainingAttemptsText": { + "type": "string", + "title": "Remaining attempts label", + "default": "", + "_adapt": { + "translatable": true + } + }, + "remainingAttemptText": { + "type": "string", + "title": "Final attempt label", + "default": "", + "_adapt": { + "translatable": true + } + } + } + } + } + } + } +} From 5e2b02124c7974c0bedbfe5666359a2bb160c0f9 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Tue, 2 Sep 2025 19:11:36 +0100 Subject: [PATCH 2/3] Make _attempts required --- schema/question-component.schema.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schema/question-component.schema.json b/schema/question-component.schema.json index 8c25621a..a6fdddd9 100644 --- a/schema/question-component.schema.json +++ b/schema/question-component.schema.json @@ -8,6 +8,7 @@ }, "with": { "required": [ + "_attempts" ], "properties": { "instruction": { @@ -303,3 +304,4 @@ } } } + From 538ebeead42b0a75e80b9f387b302d313eaaa471 Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Mon, 6 Apr 2026 09:33:54 -0600 Subject: [PATCH 3/3] Remove extra line break at EOF --- schema/question-component.schema.json | 1 - 1 file changed, 1 deletion(-) diff --git a/schema/question-component.schema.json b/schema/question-component.schema.json index a6fdddd9..b307a9ca 100644 --- a/schema/question-component.schema.json +++ b/schema/question-component.schema.json @@ -304,4 +304,3 @@ } } } -