From f0afcea97d0e1bba3439a66e2181f027e7bedb7b Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 24 Mar 2016 08:43:26 +0100 Subject: [PATCH] Fixed #283: improved JSON schema error message in case of no additionalProperties --- HISTORY.md | 6 ++++++ src/js/util.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index c45e298..f8e2fdf 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ https://github.com/josdejong/jsoneditor +## not yet released, version 5.2.1 + +- Fixed #283: improved JSON schema error message in case of no + additionalProperties. + + ## 2016-03-20, version 5.2.0 - Implemented method `editor.destroy()` to properly cleanup the editor (#278). diff --git a/src/js/util.js b/src/js/util.js index f760294..c7c8fa7 100644 --- a/src/js/util.js +++ b/src/js/util.js @@ -690,6 +690,10 @@ exports.improveSchemaError = function (error) { } } + if (error.keyword === 'additionalProperties') { + error.message = 'should NOT have additional property: ' + error.params.additionalProperty; + } + return error; };