Upgrade to `ajv@6`

This commit is contained in:
jos 2019-06-12 15:11:41 +02:00
parent b78ad35670
commit 9dfc1aab39
4 changed files with 42 additions and 108 deletions

View File

@ -3,6 +3,13 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet published, version 6.0.0
- Breaking change: upgraded dependency `ajv@6.10.0`, supporting JSON schema
draft-07 alongside draft-06 and draft-04.
- Upgraded dependency `vanilla-picker@2.8.1`.
## 2019-06-08, version 5.34.0 ## 2019-06-08, version 5.34.0
- Extended the autocomplete feature with new options `filter` and `trigger`. - Extended the autocomplete feature with new options `filter` and `trigger`.

123
package-lock.json generated
View File

@ -232,14 +232,14 @@
"dev": true "dev": true
}, },
"ajv": { "ajv": {
"version": "5.5.2", "version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"requires": { "requires": {
"co": "^4.6.0", "fast-deep-equal": "^2.0.1",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0" "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
} }
}, },
"ajv-errors": { "ajv-errors": {
@ -1107,11 +1107,6 @@
"readable-stream": "^2.3.5" "readable-stream": "^2.3.5"
} }
}, },
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
},
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
@ -1992,9 +1987,9 @@
} }
}, },
"fast-deep-equal": { "fast-deep-equal": {
"version": "1.1.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.0.0", "version": "2.0.0",
@ -3127,32 +3122,6 @@
"requires": { "requires": {
"ajv": "^6.5.5", "ajv": "^6.5.5",
"har-schema": "^2.0.0" "har-schema": "^2.0.0"
},
"dependencies": {
"ajv": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"dev": true
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
}
} }
}, },
"has": { "has": {
@ -3715,9 +3684,9 @@
"dev": true "dev": true
}, },
"json-schema-traverse": { "json-schema-traverse": {
"version": "0.3.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
}, },
"json-source-map": { "json-source-map": {
"version": "0.4.0", "version": "0.4.0",
@ -4277,9 +4246,9 @@
} }
}, },
"mobius1-selectr": { "mobius1-selectr": {
"version": "2.4.10", "version": "2.4.12",
"resolved": "https://registry.npmjs.org/mobius1-selectr/-/mobius1-selectr-2.4.10.tgz", "resolved": "https://registry.npmjs.org/mobius1-selectr/-/mobius1-selectr-2.4.12.tgz",
"integrity": "sha512-U/pQ8jZwO7z3Mf9OYzJR6AKfleF5jSBIueKKxGMr/tgyLuTWgchgFyeaXpAIz3Cbp+7eIN1hw5D2gxc4cNnOkQ==" "integrity": "sha512-zyGyhFaPCja2oHOud+9vOpLtIbIGv79jf0X1sfbBCCZ7UFHQIbx6yladAlyYU9Qq5zvsYw2Boa1CivSKvxLEHA=="
}, },
"mocha": { "mocha": {
"version": "6.1.4", "version": "6.1.4",
@ -5213,8 +5182,7 @@
"punycode": { "punycode": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
"dev": true
}, },
"qs": { "qs": {
"version": "6.5.2", "version": "6.5.2",
@ -5626,32 +5594,6 @@
"ajv": "^6.1.0", "ajv": "^6.1.0",
"ajv-errors": "^1.0.0", "ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0" "ajv-keywords": "^3.1.0"
},
"dependencies": {
"ajv": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"dev": true
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
}
} }
}, },
"semver": { "semver": {
@ -6512,7 +6454,6 @@
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"dev": true,
"requires": { "requires": {
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
@ -6603,9 +6544,9 @@
"dev": true "dev": true
}, },
"vanilla-picker": { "vanilla-picker": {
"version": "2.8.0", "version": "2.8.1",
"resolved": "https://registry.npmjs.org/vanilla-picker/-/vanilla-picker-2.8.0.tgz", "resolved": "https://registry.npmjs.org/vanilla-picker/-/vanilla-picker-2.8.1.tgz",
"integrity": "sha512-NPBxrtLi2LA2mEyRLW+Lyt7Eqtm0t0SmKqscE5RaugXLtJXXjPzy6r65fqLiQkhRc2WoLnmj2m/EnTWKN4hL+g==", "integrity": "sha512-mzjMw0WbeS6qi+wzXSCfHFL7Jmvp7sJfXq0FfOvUEAAnCI6cmgCUVJ+wpr2c3g+Gt9AypLpHks3oeIkX6nCM9A==",
"requires": { "requires": {
"@sphinxxxx/color-conversion": "^2.2.1", "@sphinxxxx/color-conversion": "^2.2.1",
"drag-tracker": "^1.0.0" "drag-tracker": "^1.0.0"
@ -6761,32 +6702,6 @@
"terser-webpack-plugin": "^1.1.0", "terser-webpack-plugin": "^1.1.0",
"watchpack": "^1.5.0", "watchpack": "^1.5.0",
"webpack-sources": "^1.3.0" "webpack-sources": "^1.3.0"
},
"dependencies": {
"ajv": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"dev": true
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
}
} }
}, },
"webpack-sources": { "webpack-sources": {

View File

@ -23,14 +23,14 @@
"test": "mocha test" "test": "mocha test"
}, },
"dependencies": { "dependencies": {
"ajv": "5.5.2", "ajv": "6.10.0",
"brace": "0.11.1", "brace": "0.11.1",
"javascript-natural-sort": "0.7.1", "javascript-natural-sort": "0.7.1",
"jmespath": "0.15.0", "jmespath": "0.15.0",
"json-source-map": "0.4.0", "json-source-map": "0.4.0",
"mobius1-selectr": "2.4.10", "mobius1-selectr": "2.4.12",
"picomodal": "3.0.0", "picomodal": "3.0.0",
"vanilla-picker": "2.8.0" "vanilla-picker": "2.8.1"
}, },
"devDependencies": { "devDependencies": {
"date-format": "2.0.0", "date-format": "2.0.0",

View File

@ -351,8 +351,20 @@ JSONEditor.prototype.setSchema = function (schema, schemaRefs) {
var ajv; var ajv;
try { try {
// grab ajv from options if provided, else create a new instance // grab ajv from options if provided, else create a new instance
ajv = this.options.ajv || Ajv({ allErrors: true, verbose: true }); if (this.options.ajv) {
ajv = this.options.ajv
}
else {
ajv = Ajv({
allErrors: true,
verbose: true,
schemaId: 'auto'
});
// support both draft-04 and draft-06 alongside the latest draft-07
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
}
} }
catch (err) { catch (err) {
console.warn('Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`.'); console.warn('Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`.');