From 1f3f86e5756d2934780e3f937c39193a88ae6a05 Mon Sep 17 00:00:00 2001 From: German Bisurgi Date: Mon, 11 Nov 2024 09:11:18 +0100 Subject: [PATCH] Added "force" param to showValidationErrors() method --- src/editors/editor.js | 4 ++-- src/jedi.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/editors/editor.js b/src/editors/editor.js index 0e5fc8b..6450295 100644 --- a/src/editors/editor.js +++ b/src/editors/editor.js @@ -116,7 +116,7 @@ class Editor { * Shows validation messages in the editor container. * @private */ - showValidationErrors (errors) { + showValidationErrors (errors, force = false) { errors = errors.filter((error) => { return error.path === this.instance.path }) @@ -126,7 +126,7 @@ class Editor { const neverShowErrors = this.instance.jedi.options.showErrors === 'never' || getSchemaXOption(this.instance.schema, 'showErrors') === 'never' - if (neverShowErrors || errors.length === 0) { + if ((neverShowErrors && !force) || errors.length === 0) { return } diff --git a/src/jedi.js b/src/jedi.js index f06a515..fc4d730 100644 --- a/src/jedi.js +++ b/src/jedi.js @@ -330,7 +330,7 @@ class Jedi extends EventEmitter { * If an errors list is passed, it will display these errors; * otherwise, it will retrieve existing errors from the instance. * - * @param {Object|null} errorsList - An optional object containing error messages. + * @param {Array|null} errorsList - An optional array containing error messages. * @returns {boolean} Returns `true` if the container exists and errors are displayed, * or `false` if there is no container and thus no errors are displayed. */ @@ -343,7 +343,7 @@ class Jedi extends EventEmitter { Object.keys(this.instances).forEach((key) => { const instance = this.instances[key] - instance.ui.showValidationErrors(errors) + instance.ui.showValidationErrors(errors, true) }) }