Skip to content

Commit

Permalink
Added "force" param to showValidationErrors() method
Browse files Browse the repository at this point in the history
  • Loading branch information
gbisurgi committed Nov 11, 2024
1 parent cf367d3 commit 1f3f86e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/editors/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand All @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions src/jedi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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)
})
}

Expand Down

0 comments on commit 1f3f86e

Please sign in to comment.