josdejong / josdejong/jsoneditor
Change Json schema validation error message
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Is there a way to change the validation error message instead of using the default message? Here is what I have tries so far:
```
onValidationError: function (errors) {
console.debug(errors)
errors.forEach((error) => {
switch (error.type) {
case 'validation': // schema validation error
if(error.schemaPath === "someIdentifier") {
error.message = "Custom Message";
}
break;
case 'customValidation': // custom validation error
break;
case 'error': // json parse error
break;
}
});
},
```
The custom message is not reflected in the json editor. Any help would be appreciated!
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.