From 81de5eee08ec54ef192b1698c9cfb7e4d2e43bf3 Mon Sep 17 00:00:00 2001 From: Martyn Colmer <46242834+martyncolmer@users.noreply.github.com> Date: Thu, 25 Aug 2022 10:13:29 +0100 Subject: [PATCH] fix for mutually exclusive required (#109) --- src/eq_schema/schema/Question/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/eq_schema/schema/Question/index.js b/src/eq_schema/schema/Question/index.js index d40c1ad4..3a3bda56 100644 --- a/src/eq_schema/schema/Question/index.js +++ b/src/eq_schema/schema/Question/index.js @@ -92,7 +92,7 @@ class Question { question.answers.some((answer) => answer.type === MUTUALLY_EXCLUSIVE) ) { this.type = "MutuallyExclusive"; - this.mandatory = false; + this.mandatory = question.answers[0].properties.required; this.answers = this.buildMutuallyExclusiveAnswers( mutuallyExclusive, question.answers, @@ -168,6 +168,7 @@ class Question { buildMutuallyExclusiveAnswers(mutuallyExclusive, answers, ctx) { let mutuallyExclusiveAnswer; answers.forEach((answer) => { + answer.properties.required = false; if (answer.type === MUTUALLY_EXCLUSIVE && answer.options.length === 1) { answers = answers.filter( (answer) => answer.type !== MUTUALLY_EXCLUSIVE