|
24 | 24 | * Copyright (c) 2011-2016 Jos de Jong, http://jsoneditoronline.org
|
25 | 25 | *
|
26 | 26 | * @author Jos de Jong, <[email protected]>
|
27 |
| - * @version 5.1.0 |
28 |
| - * @date 2016-01-14 |
| 27 | + * @version 5.1.1 |
| 28 | + * @date 2016-01-16 |
29 | 29 | */
|
30 | 30 | (function webpackUniversalModuleDefinition(root, factory) {
|
31 | 31 | if(typeof exports === 'object' && typeof module === 'object')
|
@@ -162,7 +162,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
162 | 162 | 'ace', 'theme',
|
163 | 163 | 'ajv', 'schema',
|
164 | 164 | 'onChange', 'onEditable', 'onError', 'onModeChange',
|
165 |
| - 'escapeUnicode', 'history', 'mode', 'modes', 'name', 'indentation' |
| 165 | + 'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation' |
166 | 166 | ];
|
167 | 167 |
|
168 | 168 | Object.keys(options).forEach(function (option) {
|
@@ -361,7 +361,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
361 | 361 | var ajv;
|
362 | 362 | try {
|
363 | 363 | // grab ajv from options if provided, else create a new instance
|
364 |
| - ajv = this.options.ajv || Ajv({ allErrors: true }); |
| 364 | + ajv = this.options.ajv || Ajv({ allErrors: true, verbose: true }); |
365 | 365 |
|
366 | 366 | }
|
367 | 367 | catch (err) {
|
@@ -607,7 +607,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
607 | 607 | }
|
608 | 608 |
|
609 | 609 | // clear search
|
610 |
| - this.searchBox.clear(); |
| 610 | + if (this.searchBox) { |
| 611 | + this.searchBox.clear(); |
| 612 | + } |
611 | 613 | };
|
612 | 614 |
|
613 | 615 | /**
|
@@ -832,12 +834,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
832 | 834 | if (this.validateSchema) {
|
833 | 835 | var valid = this.validateSchema(root.getValue());
|
834 | 836 | if (!valid) {
|
835 |
| - var schema = this.options.schema; |
836 |
| - |
837 | 837 | // apply all new errors
|
838 | 838 | schemaErrors = this.validateSchema.errors
|
839 | 839 | .map(function (error) {
|
840 |
| - return util.improveSchemaError(schema, error); |
| 840 | + return util.improveSchemaError(error); |
841 | 841 | })
|
842 | 842 | .map(function findNode (error) {
|
843 | 843 | return {
|
@@ -1611,6 +1611,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
1611 | 1611 | }
|
1612 | 1612 | ];
|
1613 | 1613 |
|
| 1614 | + |
1614 | 1615 | /***/ },
|
1615 | 1616 | /* 2 */
|
1616 | 1617 | /***/ function(module, exports, __webpack_require__) {
|
@@ -2022,11 +2023,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
2022 | 2023 | if (doValidate && this.validateSchema) {
|
2023 | 2024 | var valid = this.validateSchema(json);
|
2024 | 2025 | if (!valid) {
|
2025 |
| - var schema = this.options.schema; |
2026 |
| - errors = this.validateSchema.errors |
2027 |
| - .map(function (error) { |
2028 |
| - return util.improveSchemaError(schema, error); |
2029 |
| - }); |
| 2026 | + errors = this.validateSchema.errors.map(function (error) { |
| 2027 | + return util.improveSchemaError(error); |
| 2028 | + }); |
2030 | 2029 | }
|
2031 | 2030 | }
|
2032 | 2031 |
|
@@ -2755,34 +2754,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
2755 | 2754 | return [prop].concat(parsePath(remainder))
|
2756 | 2755 | };
|
2757 | 2756 |
|
2758 |
| - /** |
2759 |
| - * Retrieve a part of the schema |
2760 |
| - * @param {Object} schema |
2761 |
| - * @param {string} schemaPath A path like "#/properties/gender/enum" |
2762 |
| - * @return {Object} Returns the found part of the schema, or undefined when not found. |
2763 |
| - */ |
2764 |
| - exports.getFromSchema = function (schema, schemaPath) { |
2765 |
| - var path = schemaPath.split('/'); |
2766 |
| - path.shift(); // remove the first # |
2767 |
| - |
2768 |
| - var obj = schema; |
2769 |
| - var prop; |
2770 |
| - while (prop = path.shift()) { |
2771 |
| - obj = obj[prop]; |
2772 |
| - } |
2773 |
| - |
2774 |
| - return obj; |
2775 |
| - }; |
2776 |
| - |
2777 | 2757 | /**
|
2778 | 2758 | * Improve the error message of a JSON schema error
|
2779 |
| - * @param {Object} schema |
2780 | 2759 | * @param {Object} error
|
2781 | 2760 | * @return {Object} The error
|
2782 | 2761 | */
|
2783 |
| - exports.improveSchemaError = function (schema, error) { |
2784 |
| - if (error.keyword === 'enum') { |
2785 |
| - var enums = exports.getFromSchema(schema, error.schemaPath); |
| 2762 | + exports.improveSchemaError = function (error) { |
| 2763 | + if (error.keyword === 'enum' && Array.isArray(error.schema)) { |
| 2764 | + var enums = error.schema; |
2786 | 2765 | if (enums) {
|
2787 | 2766 | enums = enums.map(function (value) {
|
2788 | 2767 | return JSON.stringify(value);
|
|
0 commit comments