diff --git a/package-lock.json b/package-lock.json index c83171b575c..bebbde3c5a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -304,7 +304,6 @@ "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.48.0.tgz", "integrity": "sha512-RB9bKgYTVUiOcEb5bOcZ169jiiVW811dCsJoLT19DcbbFmU4QaK0ghSTssij35QBQ3SCOitXOUrHcGgNVwS7sQ==", "license": "MIT", - "peer": true, "dependencies": { "@algolia/client-common": "5.48.0", "@algolia/requester-browser-xhr": "5.48.0", @@ -457,7 +456,6 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -1281,22 +1279,6 @@ "node": ">=10" } }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", @@ -5006,8 +4988,7 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/linkify-it": { "version": "5.0.0", @@ -5020,7 +5001,6 @@ "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", "license": "MIT", - "peer": true, "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" @@ -5046,7 +5026,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz", "integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==", "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -5533,7 +5512,6 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -5610,8 +5588,8 @@ "version": "8.17.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -5623,21 +5601,11 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ajv-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", - "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", - "license": "MIT", - "peerDependencies": { - "ajv": ">=5.0.0" - } - }, "node_modules/algoliasearch": { "version": "5.48.0", "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.48.0.tgz", "integrity": "sha512-aD8EQC6KEman6/S79FtPdQmB7D4af/etcRL/KwiKFKgAE62iU8c5PeEQvpvIcBPurC3O/4Lj78nOl7ZcoazqSw==", "license": "MIT", - "peer": true, "dependencies": { "@algolia/abtesting": "1.14.0", "@algolia/client-abtesting": "5.48.0", @@ -6353,7 +6321,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -7395,7 +7362,6 @@ "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", @@ -8326,7 +8292,6 @@ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", "license": "MIT", "optional": true, - "peer": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -8546,44 +8511,6 @@ "dev": true, "license": "MIT" }, - "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -8667,7 +8594,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -9446,6 +9372,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { @@ -9720,7 +9647,6 @@ "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.8.0.tgz", "integrity": "sha512-/yNdlIkpWbM0ptxno3ONTuf+2g318kh2ez3KSeZN5dZ8YC6AAmgeWz+GasYYiBJPFaYcSAPeu4GfhUaChzIJXA==", "license": "MIT", - "peer": true, "dependencies": { "tabbable": "^6.4.0" } @@ -11755,7 +11681,6 @@ "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", "devOptional": true, "license": "MIT", - "peer": true, "bin": { "jiti": "lib/jiti-cli.mjs" } @@ -12436,7 +12361,6 @@ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz", "integrity": "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==", "license": "MIT", - "peer": true, "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", @@ -14376,7 +14300,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -15110,6 +15033,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -15860,7 +15784,6 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz", "integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==", "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -18268,6 +18191,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" @@ -18369,7 +18293,6 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -18876,7 +18799,6 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.28.tgz", "integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==", "license": "MIT", - "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.28", "@vue/compiler-sfc": "3.5.28", @@ -19644,8 +19566,8 @@ "@npmcli/config": "^10.4.0", "@ui5/fs": "^5.0.0-alpha.3", "@ui5/logger": "^5.0.0-alpha.3", - "ajv": "^6.12.6", - "ajv-errors": "^1.0.1", + "ajv": "^8.18.0", + "ajv-errors": "^3.0.0", "chalk": "^5.6.2", "escape-string-regexp": "^5.0.0", "globby": "^14.1.0", @@ -19692,26 +19614,29 @@ } }, "packages/project/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, - "packages/project/node_modules/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==", - "license": "MIT" + "packages/project/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "license": "MIT", + "peerDependencies": { + "ajv": "^8.0.1" + } }, "packages/server": { "name": "@ui5/server", diff --git a/packages/project/lib/validation/ValidationError.js b/packages/project/lib/validation/ValidationError.js index fabdbd6e8a6..709fcb5c061 100644 --- a/packages/project/lib/validation/ValidationError.js +++ b/packages/project/lib/validation/ValidationError.js @@ -80,8 +80,8 @@ class ValidationError extends Error { } let message = "Configuration "; - if (error.dataPath) { - message += chalk.underline(chalk.red(error.dataPath.substr(1))) + " "; + if (error.instancePath) { + message += chalk.underline(chalk.red(error.instancePath.substr(1))) + " "; } switch (error.keyword) { @@ -107,7 +107,7 @@ class ValidationError extends Error { static _findDuplicateError(error, errorIndex, errors) { const foundIndex = errors.findIndex(($) => { - if ($.dataPath !== error.dataPath) { + if ($.instancePath !== error.instancePath) { return false; } else if ($.keyword !== error.keyword) { return false; @@ -131,13 +131,13 @@ class ValidationError extends Error { } static analyzeYamlError({error, yaml}) { - if (error.dataPath === "" && error.keyword === "required") { + if (error.instancePath === "" && error.keyword === "required") { // There is no line/column for a missing required property on root level return {line: -1, column: -1}; } // Skip leading / - const objectPath = error.dataPath.substr(1).split("/"); + const objectPath = error.instancePath.substr(1).split("/"); if (error.keyword === "additionalProperties") { objectPath.push(error.params.additionalProperty); diff --git a/packages/project/package.json b/packages/project/package.json index 64bec2c55c0..2256b9461bc 100644 --- a/packages/project/package.json +++ b/packages/project/package.json @@ -59,8 +59,8 @@ "@npmcli/config": "^10.4.0", "@ui5/fs": "^5.0.0-alpha.3", "@ui5/logger": "^5.0.0-alpha.3", - "ajv": "^6.12.6", - "ajv-errors": "^1.0.1", + "ajv": "^8.18.0", + "ajv-errors": "^3.0.0", "chalk": "^5.6.2", "escape-string-regexp": "^5.0.0", "globby": "^14.1.0", diff --git a/packages/project/test/lib/validation/ValidationError.js b/packages/project/test/lib/validation/ValidationError.js index dd32292ef8f..08ff9d77ac0 100644 --- a/packages/project/test/lib/validation/ValidationError.js +++ b/packages/project/test/lib/validation/ValidationError.js @@ -9,15 +9,15 @@ test.afterEach.always((t) => { test.serial("ValidationError constructor", (t) => { const errors = [ - {dataPath: "", keyword: "", message: "error1", params: {}}, - {dataPath: "", keyword: "", message: "error2", params: {}} + {instancePath: "", keyword: "", message: "error1", params: {}}, + {instancePath: "", keyword: "", message: "error2", params: {}} ]; const project = {id: "id"}; const schema = {schema: "schema"}; const data = {data: "data"}; const yaml = {path: "path", source: "source", documentIndex: 0}; - const filteredErrors = [{dataPath: "", keyword: "", message: "error1", params: {}}]; + const filteredErrors = [{instancePath: "", keyword: "", message: "error1", params: {}}]; const filterErrorsStub = sinon.stub(ValidationError, "filterErrors"); filterErrorsStub.returns(filteredErrors); @@ -52,37 +52,37 @@ test.serial("ValidationError.filterErrors", (t) => { keyword: "if" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword2" }, { - dataPath: "dataPath3", + instancePath: "dataPath3", keyword: "keyword2" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword1", params: { type: "foo" } }, { - dataPath: "dataPath4", + instancePath: "dataPath4", keyword: "keyword5", params: { type: "foo" } }, { - dataPath: "dataPath6", + instancePath: "dataPath6", keyword: "keyword6", params: { errors: [ @@ -96,7 +96,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "dataPath6", keyword: "keyword6", params: { errors: [ @@ -110,7 +110,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "dataPath6", keyword: "keyword6", params: { errors: [ @@ -127,33 +127,33 @@ test.serial("ValidationError.filterErrors", (t) => { const expectedErrors = [ { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword2" }, { - dataPath: "dataPath3", + instancePath: "dataPath3", keyword: "keyword2" }, { - dataPath: "dataPath1", + instancePath: "dataPath1", keyword: "keyword1", params: { type: "foo" } }, { - dataPath: "dataPath4", + instancePath: "dataPath4", keyword: "keyword5", params: { type: "foo" } }, { - dataPath: "dataPath6", + instancePath: "dataPath6", keyword: "keyword6", params: { errors: [ @@ -167,7 +167,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "dataPath6", keyword: "keyword6", params: { errors: [ @@ -321,7 +321,7 @@ test.serial("ValidationError.getSourceExtract (Windows Line-Endings)", (t) => { }); test.serial("ValidationError.analyzeYamlError: Property", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -341,7 +341,7 @@ property5: value5 }); test.serial("ValidationError.analyzeYamlError: Nested property", (t) => { - const error = {dataPath: "/property2/property3"}; + const error = {instancePath: "/property2/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -360,7 +360,7 @@ property3: value3 }); test.serial("ValidationError.analyzeYamlError: Array", (t) => { - const error = {dataPath: "/property/list/2/name"}; + const error = {instancePath: "/property/list/2/name"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -380,7 +380,7 @@ test.serial("ValidationError.analyzeYamlError: Array", (t) => { }); test.serial("ValidationError.analyzeYamlError: Nested array", (t) => { - const error = {dataPath: "/items/2/subItems/1"}; + const error = {instancePath: "/items/2/subItems/1"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -405,7 +405,7 @@ test.serial("ValidationError.analyzeYamlError: Nested array", (t) => { }); test.serial("ValidationError.analyzeYamlError: Nested array (Windows Line-Endings)", (t) => { - const error = {dataPath: "/items/2/subItems/1"}; + const error = {instancePath: "/items/2/subItems/1"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -429,7 +429,7 @@ test.serial("ValidationError.analyzeYamlError: Nested array (Windows Line-Ending }); test.serial("ValidationError.analyzeYamlError: Array with square brackets (not supported)", (t) => { - const error = {dataPath: "/items/2"}; + const error = {instancePath: "/items/2"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -445,7 +445,7 @@ test.serial("ValidationError.analyzeYamlError: Array with square brackets (not s }); test.serial("ValidationError.analyzeYamlError: Multiline array with square brackets (not supported)", (t) => { - const error = {dataPath: "/items/2"}; + const error = {instancePath: "/items/2"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -465,7 +465,7 @@ test.serial("ValidationError.analyzeYamlError: Multiline array with square brack }); test.serial("ValidationError.analyzeYamlError: Nested property with comments", (t) => { - const error = {dataPath: "/property1/property2/property3/property4"}; + const error = {instancePath: "/property1/property2/property3/property4"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -485,7 +485,7 @@ test.serial("ValidationError.analyzeYamlError: Nested property with comments", ( }); test.serial("ValidationError.analyzeYamlError: Nested properties with same name", (t) => { - const error = {dataPath: "/property/property/property/property"}; + const error = {instancePath: "/property/property/property/property"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -505,7 +505,7 @@ test.serial("ValidationError.analyzeYamlError: Nested properties with same name" }); test.serial("ValidationError.analyzeYamlError: Error keyword=required, no dataPath", (t) => { - const error = {dataPath: "", keyword: "required"}; + const error = {instancePath: "", keyword: "required"}; const yaml = { path: "/my-project/ui5.yaml", source: ``, @@ -519,7 +519,7 @@ test.serial("ValidationError.analyzeYamlError: Error keyword=required, no dataPa }); test.serial("ValidationError.analyzeYamlError: Error keyword=required", (t) => { - const error = {dataPath: "/property2", keyword: "required"}; + const error = {instancePath: "/property2", keyword: "required"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -538,7 +538,7 @@ property2: test.serial("ValidationError.analyzeYamlError: Error keyword=additionalProperties", (t) => { const error = { - dataPath: "/property2", + instancePath: "/property2", keyword: "additionalProperties", params: { additionalProperty: "property3" @@ -561,7 +561,7 @@ property2: }); test.serial("ValidationError.analyzeYamlError: documentIndex=0 (Without leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -586,7 +586,7 @@ property5: value5document2`, }); test.serial("ValidationError.analyzeYamlError: documentIndex=0 (With leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -612,7 +612,7 @@ property5: value5document2`, }); test.serial("ValidationError.analyzeYamlError: documentIndex=0 (With leading separator and empty lines)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -642,7 +642,7 @@ property5: value5document2`, }); test.serial("ValidationError.analyzeYamlError: documentIndex=2 (Without leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -674,7 +674,7 @@ property5: value5document3 }); test.serial("ValidationError.analyzeYamlError: documentIndex=2 (With leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -707,7 +707,7 @@ property5: value5document3 }); test.serial("ValidationError.analyzeYamlError: documentIndex=2 (With leading separator and empty lines)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -745,7 +745,7 @@ property5: value5document3 }); test.serial("ValidationError.analyzeYamlError: Invalid documentIndex=1 (With leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -766,7 +766,7 @@ property5: value5document1 }); test.serial("ValidationError.analyzeYamlError: Invalid documentIndex=1 (Without leading separator)", (t) => { - const error = {dataPath: "/property3"}; + const error = {instancePath: "/property3"}; const yaml = { path: "/my-project/ui5.yaml", source: @@ -787,7 +787,7 @@ property5: value5document1 test.serial("ValidationError.formatMessage: keyword=type dataPath=", (t) => { const error = { - dataPath: "", + instancePath: "", keyword: "type", message: "should be object", params: { @@ -804,7 +804,7 @@ test.serial("ValidationError.formatMessage: keyword=type dataPath=", (t) => { test.serial("ValidationError.formatMessage: keyword=type", (t) => { const error = { - dataPath: "/foo", + instancePath: "/foo", keyword: "type", message: "should be object", params: { @@ -821,7 +821,7 @@ test.serial("ValidationError.formatMessage: keyword=type", (t) => { test.serial("ValidationError.formatMessage: keyword=required w/o dataPath", (t) => { const error = { - dataPath: "", + instancePath: "", keyword: "required", message: "should have required property 'specVersion'", params: { @@ -839,7 +839,7 @@ test.serial("ValidationError.formatMessage: keyword=required w/o dataPath", (t) test.serial("ValidationError.formatMessage: keyword=required", (t) => { const error = { keyword: "required", - dataPath: "/metadata", + instancePath: "/metadata", schemaPath: "#/definitions/metadata/required", params: {missingProperty: "name"}, message: "should have required property 'name'" @@ -854,7 +854,7 @@ test.serial("ValidationError.formatMessage: keyword=required", (t) => { test.serial("ValidationError.formatMessage: keyword=errorMessage", (t) => { const error = { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: `Unsupported "specVersion" @@ -864,7 +864,7 @@ For details, see: https://ui5.github.io/cli/pages/Configuration/#specification-v params: { errors: [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "enum", message: "should be equal to one of the allowed values", params: { @@ -895,7 +895,7 @@ For details, see: https://ui5.github.io/cli/pages/Configuration/#specification-v test.serial("ValidationError.formatMessage: keyword=additionalProperties", (t) => { const error = { keyword: "additionalProperties", - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", schemaPath: "#/properties/configuration/additionalProperties", params: {additionalProperty: "propertiesFileEncoding"}, message: "should NOT have additional properties" @@ -912,7 +912,7 @@ test.serial("ValidationError.formatMessage: keyword=additionalProperties", (t) = test.serial("ValidationError.formatMessage: keyword=enum", (t) => { const error = { keyword: "enum", - dataPath: "/type", + instancePath: "/type", schemaPath: "#/properties/type/enum", params: { allowedValues: ["application", "library", "theme-library", "module"] diff --git a/packages/project/test/lib/validation/schema/__helper__/builder-bundleOptions.js b/packages/project/test/lib/validation/schema/__helper__/builder-bundleOptions.js index 967da600b4d..f5ffe0dfcc6 100644 --- a/packages/project/test/lib/validation/schema/__helper__/builder-bundleOptions.js +++ b/packages/project/test/lib/validation/schema/__helper__/builder-bundleOptions.js @@ -62,11 +62,11 @@ export default { }, [ { keyword: "additionalProperties", - dataPath: "/builder/bundles/0/bundleOptions", + instancePath: "/builder/bundles/0/bundleOptions", params: { additionalProperty: "usePredefineCalls", }, - message: "should NOT have additional properties", + message: "must NOT have additional properties", }, ]); }); @@ -94,46 +94,46 @@ export default { }, [ { keyword: "type", - dataPath: "/builder/bundles/0/bundleOptions/optimize", + instancePath: "/builder/bundles/0/bundleOptions/optimize", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/decorateBootstrapModule", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/addTryCatchRestartWrapper", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/numberOfParts", params: { type: "number", }, - message: "should be number" + message: "must be number" }, { keyword: "type", - dataPath: "/builder/bundles/0/bundleOptions/sourceMap", + instancePath: "/builder/bundles/0/bundleOptions/sourceMap", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" } ]); }); @@ -187,11 +187,11 @@ export default { }, [ { keyword: "additionalProperties", - dataPath: "/builder/bundles/0/bundleOptions", + instancePath: "/builder/bundles/0/bundleOptions", params: { additionalProperty: "debugMode", }, - message: "should NOT have additional properties", + message: "must NOT have additional properties", }, ]); }); @@ -220,55 +220,55 @@ export default { }, [ { keyword: "type", - dataPath: "/builder/bundles/0/bundleOptions/optimize", + instancePath: "/builder/bundles/0/bundleOptions/optimize", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/decorateBootstrapModule", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/addTryCatchRestartWrapper", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/usePredefineCalls", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" }, { keyword: "type", - dataPath: + instancePath: "/builder/bundles/0/bundleOptions/numberOfParts", params: { type: "number", }, - message: "should be number" + message: "must be number" }, { keyword: "type", - dataPath: "/builder/bundles/0/bundleOptions/sourceMap", + instancePath: "/builder/bundles/0/bundleOptions/sourceMap", params: { type: "boolean", }, - message: "should be boolean" + message: "must be boolean" } ]); }); diff --git a/packages/project/test/lib/validation/schema/__helper__/customConfiguration.js b/packages/project/test/lib/validation/schema/__helper__/customConfiguration.js index 66ca7633f92..7ee81e56906 100644 --- a/packages/project/test/lib/validation/schema/__helper__/customConfiguration.js +++ b/packages/project/test/lib/validation/schema/__helper__/customConfiguration.js @@ -29,9 +29,9 @@ export default { "customConfiguration": {} }, additionalConfiguration), [ { - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "customConfiguration", } diff --git a/packages/project/test/lib/validation/schema/__helper__/extension.js b/packages/project/test/lib/validation/schema/__helper__/extension.js index c36624a0f8a..2c023a4f9bc 100644 --- a/packages/project/test/lib/validation/schema/__helper__/extension.js +++ b/packages/project/test/lib/validation/schema/__helper__/extension.js @@ -39,9 +39,9 @@ export default { }, "resources": {} }, additionalConfiguration), [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "resources" } @@ -58,9 +58,9 @@ export default { }, "notAllowed": true }, additionalConfiguration), [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } @@ -77,9 +77,9 @@ export default { "name": {} } }, additionalConfiguration), [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -96,26 +96,26 @@ export default { "name": {} } }, additionalConfiguration), [{ - dataPath: "/metadata/name", - keyword: "type", - message: "should be string", - params: { - type: "string", - }, - }, { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }] }, + }, { + instancePath: "/metadata/name", + keyword: "type", + message: "must be string", + params: { + type: "string", + } }]); }); }); diff --git a/packages/project/test/lib/validation/schema/__helper__/framework.js b/packages/project/test/lib/validation/schema/__helper__/framework.js index cc122546b5c..71c95eecec1 100644 --- a/packages/project/test/lib/validation/schema/__helper__/framework.js +++ b/packages/project/test/lib/validation/schema/__helper__/framework.js @@ -88,9 +88,9 @@ export default { await assertValidation(t, config, [ { - dataPath: "/framework/name", + instancePath: "/framework/name", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "OpenUI5", @@ -99,16 +99,16 @@ export default { } }, { - dataPath: "/framework/version", + instancePath: "/framework/version", keyword: "errorMessage", message: "Not a valid version according to the Semantic Versioning specification (https://semver.org/)", params: { errors: [ { - dataPath: "/framework/version", + instancePath: "/framework/version", keyword: "pattern", message: - "should match pattern \"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)" + + "must match pattern \"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)" + "(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*" + "[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\"", params: { @@ -122,41 +122,41 @@ export default { } }, { - dataPath: "/framework/libraries/0", + instancePath: "/framework/libraries/0", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } }, { - dataPath: "/framework/libraries/1", - keyword: "additionalProperties", - message: "should NOT have additional properties", + instancePath: "/framework/libraries/1", + keyword: "required", + message: "must have required property 'name'", params: { - additionalProperty: "library", + missingProperty: "name", } }, { - dataPath: "/framework/libraries/1", - keyword: "required", - message: "should have required property 'name'", + instancePath: "/framework/libraries/1", + keyword: "additionalProperties", + message: "must NOT have additional properties", params: { - missingProperty: "name", + additionalProperty: "library", } }, { - dataPath: "/framework/libraries/2/optional", + instancePath: "/framework/libraries/2/optional", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean" } }, { - dataPath: "/framework/libraries/3/development", + instancePath: "/framework/libraries/3/development", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean" } @@ -174,9 +174,9 @@ export default { "framework": {} }, [ { - dataPath: "/framework", + instancePath: "/framework", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name" } @@ -211,23 +211,23 @@ export default { } }, [ { - dataPath: "/framework/libraries/0", + instancePath: "/framework/libraries/0", keyword: "errorMessage", message: "Either \"development\" or \"optional\" can be true, but not both", params: { errors: [ { - dataPath: "/framework/libraries/0", + instancePath: "/framework/libraries/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "development", } }, { - dataPath: "/framework/libraries/0", + instancePath: "/framework/libraries/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "optional", } @@ -236,17 +236,17 @@ export default { } }, { - dataPath: "/framework/libraries/1/optional", + instancePath: "/framework/libraries/1/optional", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/framework/libraries/1/development", + instancePath: "/framework/libraries/1/development", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } diff --git a/packages/project/test/lib/validation/schema/__helper__/project.js b/packages/project/test/lib/validation/schema/__helper__/project.js index c2a4cae1d5b..838b3fb4942 100644 --- a/packages/project/test/lib/validation/schema/__helper__/project.js +++ b/packages/project/test/lib/validation/schema/__helper__/project.js @@ -41,9 +41,9 @@ export default { "specVersion": specVersion, "type": type }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'metadata'", + message: "must have required property 'metadata'", params: { missingProperty: "metadata", } @@ -56,9 +56,9 @@ export default { "type": type, "metadata": "foo" }, [{ - dataPath: "/metadata", + instancePath: "/metadata", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } @@ -71,9 +71,9 @@ export default { "type": type, "metadata": {} }, [{ - dataPath: "/metadata", + instancePath: "/metadata", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } @@ -90,9 +90,9 @@ export default { } }, [ { - dataPath: "/metadata/copyright", + instancePath: "/metadata/copyright", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -110,9 +110,9 @@ export default { } }, [ { - dataPath: "/metadata", + instancePath: "/metadata", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "copyrihgt" } @@ -152,9 +152,9 @@ export default { } }, [ { - dataPath: "/metadata/deprecated", + instancePath: "/metadata/deprecated", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -194,9 +194,9 @@ export default { } }, [ { - dataPath: "/metadata/sapInternal", + instancePath: "/metadata/sapInternal", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -236,9 +236,9 @@ export default { } }, [ { - dataPath: "/metadata/allowSapInternal", + instancePath: "/metadata/allowSapInternal", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -255,9 +255,9 @@ export default { }, "notAllowed": true }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, @@ -276,9 +276,9 @@ export default { } }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -302,14 +302,14 @@ export default { } }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/extension.js b/packages/project/test/lib/validation/schema/specVersion/kind/extension.js index 54fbb1fdc78..0e91fcd456a 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/extension.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/extension.js @@ -15,6 +15,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; }); t.deepEqual(validationError.errors, expectedErrors); } else { @@ -32,10 +33,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension"}); const thresholds = { - statements: 80, - branches: 70, + statements: 70, + branches: 60, functions: 100, - lines: 80 + lines: 70 }; t.context.ajvCoverage.verify(thresholds); }); @@ -89,9 +90,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { "name": "my-project" } }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -107,9 +108,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { "name": "my-project" } }, [{ - dataPath: "/type", + instancePath: "/type", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "task", @@ -129,9 +130,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { }, "shims": {} }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'specVersion'", + message: "must have required property 'specVersion'", params: { missingProperty: "specVersion", } @@ -145,9 +146,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { "type": "project-shim", "shims": {} }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'metadata'", + message: "must have required property 'metadata'", params: { missingProperty: "metadata", } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/extension/project-shim.js b/packages/project/test/lib/validation/schema/specVersion/kind/extension/project-shim.js index 286f3b0bddd..d7ddf574d50 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/extension/project-shim.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/extension/project-shim.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-project-shim"}); const thresholds = { - statements: 75, - branches: 60, + statements: 50, + branches: 55, functions: 100, - lines: 70 + lines: 50 }; t.context.ajvCoverage.verify(thresholds); }); @@ -85,41 +87,41 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { "middleware": {} }, [ { - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "middleware" } }, { - dataPath: "/shims", + instancePath: "/shims", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/shims/dependencies/my-dependency", + instancePath: "/shims/dependencies/my-dependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/shims/collections/foo", + instancePath: "/shims/collections/foo", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/shims/collections/foo/modules/lib-1", + instancePath: "/shims/collections/foo/modules/lib-1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } @@ -139,14 +141,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) }, "shims": {} }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", } @@ -162,14 +164,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) }, "shims": {} }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, } @@ -185,14 +187,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) }, "shims": {} }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js b/packages/project/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js index ceb1e6dc3c5..b9a62c98193 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-server-middleware"}); const thresholds = { - statements: 70, - branches: 55, + statements: 50, + branches: 50, functions: 100, - lines: 70 + lines: 50 }; t.context.ajvCoverage.verify(thresholds); }); @@ -59,14 +61,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", } @@ -84,14 +86,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, } @@ -109,14 +111,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/extension/task.js b/packages/project/test/lib/validation/schema/specVersion/kind/extension/task.js index e8ad322537e..a30ba261cba 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/extension/task.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/extension/task.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-task"}); const thresholds = { - statements: 70, - branches: 55, + statements: 50, + branches: 50, functions: 100, - lines: 70 + lines: 50 }; t.context.ajvCoverage.verify(thresholds); }); @@ -59,14 +61,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", } @@ -84,14 +86,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, } @@ -109,14 +111,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "path": "/bar" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project.js b/packages/project/test/lib/validation/schema/specVersion/kind/project.js index 40319e20666..c2ed6e1e2c4 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project.js @@ -14,6 +14,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; }); t.deepEqual(validationError.errors, expectedErrors); } else { @@ -31,10 +32,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project"}); const thresholds = { - statements: 85, - branches: 75, + statements: 70, + branches: 65, functions: 100, - lines: 90 + lines: 70 }; t.context.ajvCoverage.verify(thresholds); }); @@ -111,14 +112,15 @@ test("Type component, legacy specVersion", async (t) => { "name": "my-component" } }, [{ - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: "The 'component' type is only supported with specVersion '5.0' and higher.", params: { errors: [{ - dataPath: "/specVersion", + emUsed: true, + instancePath: "/specVersion", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: ["5.0"], }, @@ -178,9 +180,9 @@ test("No type", async (t) => { "name": "my-project" } }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -194,9 +196,9 @@ test("No type, no kind", async (t) => { "name": "my-project" } }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -212,9 +214,9 @@ test("Invalid type", async (t) => { "name": "my-project" } }, [{ - dataPath: "/type", + instancePath: "/type", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "application", @@ -235,9 +237,9 @@ test("No specVersion", async (t) => { "name": "my-library" } }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'specVersion'", + message: "must have required property 'specVersion'", params: { missingProperty: "specVersion", } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project/application.js b/packages/project/test/lib/validation/schema/specVersion/kind/project/application.js index db7a75b6826..7717503126a 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project/application.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project/application.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project-application"}); const thresholds = { - statements: 80, - branches: 75, + statements: 65, + branches: 60, functions: 100, - lines: 80 + lines: 65 }; t.context.ajvCoverage.verify(thresholds); }); @@ -264,50 +266,50 @@ SpecificationVersion.getVersionsForRange(">=4.0").forEach(function(specVersion) }, [ { - dataPath: "/resources", + instancePath: "/resources", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: + instancePath: "/resources/configuration/propertiesFileSourceEncoding", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: ["UTF-8", "ISO-8859-1"], }, }, { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "app", }, }, { - dataPath: "/resources/configuration/paths/webapp", + instancePath: "/resources/configuration/paths/webapp", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "async", }, @@ -327,9 +329,9 @@ SpecificationVersion.getVersionsForRange(">=4.0").forEach(function(specVersion) } }, [ { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object" } @@ -518,25 +520,25 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.2").forEach(function(specVersi } }, [ { - dataPath: "/resources", + instancePath: "/resources", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/resources/configuration/propertiesFileSourceEncoding", + instancePath: "/resources/configuration/propertiesFileSourceEncoding", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "UTF-8", @@ -545,17 +547,17 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.2").forEach(function(specVersi } }, { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "app", } }, { - dataPath: "/resources/configuration/paths/webapp", + instancePath: "/resources/configuration/paths/webapp", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -574,9 +576,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.2").forEach(function(specVersi } }, [ { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object" } @@ -604,9 +606,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersi } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "excludes", }, @@ -650,9 +652,9 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload/excludes", + instancePath: "/builder/componentPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -677,33 +679,33 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/componentPreload/excludes/0", + instancePath: "/builder/componentPreload/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/1", + instancePath: "/builder/componentPreload/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/2", + instancePath: "/builder/componentPreload/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -785,25 +787,25 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings/includeDependency", + instancePath: "/builder/settings/includeDependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp", + instancePath: "/builder/settings/includeDependencyRegExp", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyTree", + instancePath: "/builder/settings/includeDependencyTree", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -838,81 +840,81 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings", + instancePath: "/builder/settings", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/settings/includeDependency/0", + instancePath: "/builder/settings/includeDependency/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/1", + instancePath: "/builder/settings/includeDependency/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/2", + instancePath: "/builder/settings/includeDependency/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + instancePath: "/builder/settings/includeDependencyRegExp/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + instancePath: "/builder/settings/includeDependencyRegExp/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", + instancePath: "/builder/settings/includeDependencyRegExp/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/0", + instancePath: "/builder/settings/includeDependencyTree/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/1", + instancePath: "/builder/settings/includeDependencyTree/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/2", + instancePath: "/builder/settings/includeDependencyTree/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -956,9 +958,9 @@ SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification/excludes", + instancePath: "/builder/minification/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -983,33 +985,33 @@ SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification", + instancePath: "/builder/minification", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/minification/excludes/0", + instancePath: "/builder/minification/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/1", + instancePath: "/builder/minification/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/2", + instancePath: "/builder/minification/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -1027,14 +1029,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "illegal/name" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", }, @@ -1048,14 +1050,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -1069,14 +1071,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a".repeat(81) } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, @@ -1163,73 +1165,73 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersi } }, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "jsdoc" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload" } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "declareModules", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition", + instancePath: "/builder/bundles/1/bundleDefinition", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + instancePath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0", keyword: "required", - message: "should have required property 'mode'", + message: "must have required property 'mode'", params: { missingProperty: "mode", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/mode", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: ["3.1", "3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ "raw", @@ -1246,57 +1248,57 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersi } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/1/bundleOptions", + instancePath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/builder/bundles/1/bundleOptions/optimize", + instancePath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + instancePath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", } }, { - dataPath: "/builder/componentPreload/paths", + instancePath: "/builder/componentPreload/paths", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/componentPreload/namespaces", + instancePath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } @@ -1382,73 +1384,73 @@ SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) } }, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "jsdoc" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload" } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "declareModules", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition", + instancePath: "/builder/bundles/1/bundleDefinition", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + instancePath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0", keyword: "required", - message: "should have required property 'mode'", + message: "must have required property 'mode'", params: { missingProperty: "mode", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/mode", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "raw", @@ -1461,57 +1463,57 @@ SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/1/bundleOptions", + instancePath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/builder/bundles/1/bundleOptions/optimize", + instancePath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + instancePath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", } }, { - dataPath: "/builder/componentPreload/paths", + instancePath: "/builder/componentPreload/paths", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/componentPreload/namespaces", + instancePath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project/component.js b/packages/project/test/lib/validation/schema/specVersion/kind/project/component.js index 441e78d0d55..b1104ba5f82 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project/component.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project/component.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project-component"}); const thresholds = { - statements: 80, - branches: 75, + statements: 65, + branches: 60, functions: 100, - lines: 80 + lines: 65 }; t.context.ajvCoverage.verify(thresholds); }); @@ -225,25 +227,25 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/resources", + instancePath: "/resources", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/resources/configuration/propertiesFileSourceEncoding", + instancePath: "/resources/configuration/propertiesFileSourceEncoding", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "UTF-8", @@ -252,17 +254,17 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "app", } }, { - dataPath: "/resources/configuration/paths/src", + instancePath: "/resources/configuration/paths/src", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -281,9 +283,9 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object" } @@ -367,73 +369,73 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "jsdoc" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload" } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "declareModules", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition", + instancePath: "/builder/bundles/1/bundleDefinition", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + instancePath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0", keyword: "required", - message: "should have required property 'mode'", + message: "must have required property 'mode'", params: { missingProperty: "mode", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/mode", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "raw", @@ -446,57 +448,57 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/1/bundleOptions", + instancePath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/builder/bundles/1/bundleOptions/optimize", + instancePath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + instancePath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", } }, { - dataPath: "/builder/componentPreload/paths", + instancePath: "/builder/componentPreload/paths", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/componentPreload/namespaces", + instancePath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } @@ -537,9 +539,9 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload/excludes", + instancePath: "/builder/componentPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -564,33 +566,33 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/componentPreload/excludes/0", + instancePath: "/builder/componentPreload/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/1", + instancePath: "/builder/componentPreload/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/2", + instancePath: "/builder/componentPreload/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -665,25 +667,25 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings/includeDependency", + instancePath: "/builder/settings/includeDependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp", + instancePath: "/builder/settings/includeDependencyRegExp", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyTree", + instancePath: "/builder/settings/includeDependencyTree", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -718,81 +720,81 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings", + instancePath: "/builder/settings", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/settings/includeDependency/0", + instancePath: "/builder/settings/includeDependency/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/1", + instancePath: "/builder/settings/includeDependency/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/2", + instancePath: "/builder/settings/includeDependency/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + instancePath: "/builder/settings/includeDependencyRegExp/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + instancePath: "/builder/settings/includeDependencyRegExp/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", + instancePath: "/builder/settings/includeDependencyRegExp/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/0", + instancePath: "/builder/settings/includeDependencyTree/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/1", + instancePath: "/builder/settings/includeDependencyTree/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/2", + instancePath: "/builder/settings/includeDependencyTree/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -833,9 +835,9 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification/excludes", + instancePath: "/builder/minification/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -860,33 +862,33 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification", + instancePath: "/builder/minification", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/minification/excludes/0", + instancePath: "/builder/minification/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/1", + instancePath: "/builder/minification/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/2", + instancePath: "/builder/minification/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -901,14 +903,14 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) "name": "illegal/name" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", }, @@ -922,14 +924,14 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) "name": "a" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -943,14 +945,14 @@ SpecificationVersion.getVersionsForRange(">=5.0").forEach(function(specVersion) "name": "a".repeat(81) } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project/library.js b/packages/project/test/lib/validation/schema/specVersion/kind/project/library.js index b51e43bcb96..b54459de214 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project/library.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project/library.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project-library"}); const thresholds = { - statements: 80, - branches: 75, + statements: 65, + branches: 60, functions: 100, - lines: 80 + lines: 65 }; t.context.ajvCoverage.verify(thresholds); }); @@ -246,17 +248,17 @@ SpecificationVersion.getVersionsForRange(">=4.0").forEach(function(specVersion) }; await assertValidation(t, config, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "cachebuster", }, }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "async", }, @@ -429,9 +431,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.2").forEach(function(specVersi } }; await assertValidation(t, config, [{ - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "cachebuster" } @@ -453,9 +455,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersi } }, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload", }, @@ -480,9 +482,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersi } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "excludes", }, @@ -526,9 +528,9 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/libraryPreload/excludes", + instancePath: "/builder/libraryPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -553,33 +555,33 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/libraryPreload", + instancePath: "/builder/libraryPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/libraryPreload/excludes/0", + instancePath: "/builder/libraryPreload/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/libraryPreload/excludes/1", + instancePath: "/builder/libraryPreload/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/libraryPreload/excludes/2", + instancePath: "/builder/libraryPreload/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -622,9 +624,9 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload/excludes", + instancePath: "/builder/componentPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -649,33 +651,33 @@ SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/componentPreload/excludes/0", + instancePath: "/builder/componentPreload/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/1", + instancePath: "/builder/componentPreload/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/componentPreload/excludes/2", + instancePath: "/builder/componentPreload/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -757,25 +759,25 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings/includeDependency", + instancePath: "/builder/settings/includeDependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp", + instancePath: "/builder/settings/includeDependencyRegExp", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyTree", + instancePath: "/builder/settings/includeDependencyTree", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -810,81 +812,81 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings", + instancePath: "/builder/settings", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/settings/includeDependency/0", + instancePath: "/builder/settings/includeDependency/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/1", + instancePath: "/builder/settings/includeDependency/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/2", + instancePath: "/builder/settings/includeDependency/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + instancePath: "/builder/settings/includeDependencyRegExp/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + instancePath: "/builder/settings/includeDependencyRegExp/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", + instancePath: "/builder/settings/includeDependencyRegExp/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/0", + instancePath: "/builder/settings/includeDependencyTree/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/1", + instancePath: "/builder/settings/includeDependencyTree/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/2", + instancePath: "/builder/settings/includeDependencyTree/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -928,9 +930,9 @@ SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification/excludes", + instancePath: "/builder/minification/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -955,33 +957,33 @@ SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) } }, [ { - dataPath: "/builder/minification", + instancePath: "/builder/minification", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/minification/excludes/0", + instancePath: "/builder/minification/excludes/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/1", + instancePath: "/builder/minification/excludes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/minification/excludes/2", + instancePath: "/builder/minification/excludes/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -999,14 +1001,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "illegal-🦜" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", }, @@ -1020,14 +1022,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -1041,14 +1043,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a".repeat(81) } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, @@ -1164,9 +1166,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersi } }, [ { - dataPath: "/resources/configuration/propertiesFileSourceEncoding", + instancePath: "/resources/configuration/propertiesFileSourceEncoding", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "UTF-8", @@ -1175,97 +1177,97 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersi } }, { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "webapp", } }, { - dataPath: "/resources/configuration/paths/src", + instancePath: "/resources/configuration/paths/src", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/resources/configuration/paths/test", + instancePath: "/resources/configuration/paths/test", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/resources/excludes", + instancePath: "/builder/resources/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/jsdoc/excludes", + instancePath: "/builder/jsdoc/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "declareModules", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition", + instancePath: "/builder/bundles/1/bundleDefinition", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + instancePath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0", keyword: "required", - message: "should have required property 'mode'", + message: "must have required property 'mode'", params: { missingProperty: "mode", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/mode", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: ["3.1", "3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ "raw", @@ -1282,121 +1284,121 @@ SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersi } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/1/bundleOptions", + instancePath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/builder/bundles/1/bundleOptions/optimize", + instancePath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + instancePath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", } }, { - dataPath: "/builder/componentPreload/paths", + instancePath: "/builder/componentPreload/paths", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/componentPreload/namespaces", + instancePath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/customTasks/0", + instancePath: "/builder/customTasks/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "afterTask", } }, { - dataPath: "/builder/customTasks/0", + instancePath: "/builder/customTasks/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "beforeTask", } }, { - dataPath: "/builder/customTasks/1", - keyword: "additionalProperties", - message: "should NOT have additional properties", + instancePath: "/builder/customTasks/1", + keyword: "required", + message: "must have required property 'name'", params: { - additionalProperty: "afterTask", + missingProperty: "name", } }, { - dataPath: "/builder/customTasks/1", + instancePath: "/builder/customTasks/1", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'beforeTask'", params: { - missingProperty: "name", + missingProperty: "beforeTask", } }, { - dataPath: "/builder/customTasks/1", - keyword: "required", - message: "should have required property 'beforeTask'", + instancePath: "/builder/customTasks/1", + keyword: "additionalProperties", + message: "must NOT have additional properties", params: { - missingProperty: "beforeTask", + additionalProperty: "afterTask", } }, { - dataPath: "/builder/customTasks/2", + instancePath: "/builder/customTasks/2", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } }, { - dataPath: "/server/settings/httpPort", + instancePath: "/server/settings/httpPort", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/server/settings/httpsPort", + instancePath: "/server/settings/httpsPort", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } @@ -1511,9 +1513,9 @@ SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) } }, [ { - dataPath: "/resources/configuration/propertiesFileSourceEncoding", + instancePath: "/resources/configuration/propertiesFileSourceEncoding", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "UTF-8", @@ -1522,97 +1524,97 @@ SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) } }, { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "webapp", } }, { - dataPath: "/resources/configuration/paths/src", + instancePath: "/resources/configuration/paths/src", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/resources/configuration/paths/test", + instancePath: "/resources/configuration/paths/test", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/resources/excludes", + instancePath: "/builder/resources/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/jsdoc/excludes", + instancePath: "/builder/jsdoc/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "declareModules", } }, { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + instancePath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition", + instancePath: "/builder/bundles/1/bundleDefinition", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + instancePath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0", keyword: "required", - message: "should have required property 'mode'", + message: "must have required property 'mode'", params: { missingProperty: "mode", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + instancePath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/mode", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "raw", @@ -1625,121 +1627,121 @@ SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) } }, { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + instancePath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/bundles/1/bundleOptions", + instancePath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } }, { - dataPath: "/builder/bundles/1/bundleOptions/optimize", + instancePath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } }, { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + instancePath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", } }, { - dataPath: "/builder/componentPreload/paths", + instancePath: "/builder/componentPreload/paths", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/componentPreload/namespaces", + instancePath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", } }, { - dataPath: "/builder/customTasks/0", + instancePath: "/builder/customTasks/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "afterTask", } }, { - dataPath: "/builder/customTasks/0", + instancePath: "/builder/customTasks/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "beforeTask", } }, { - dataPath: "/builder/customTasks/1", - keyword: "additionalProperties", - message: "should NOT have additional properties", + instancePath: "/builder/customTasks/1", + keyword: "required", + message: "must have required property 'name'", params: { - additionalProperty: "afterTask", + missingProperty: "name", } }, { - dataPath: "/builder/customTasks/1", + instancePath: "/builder/customTasks/1", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'beforeTask'", params: { - missingProperty: "name", + missingProperty: "beforeTask", } }, { - dataPath: "/builder/customTasks/1", - keyword: "required", - message: "should have required property 'beforeTask'", + instancePath: "/builder/customTasks/1", + keyword: "additionalProperties", + message: "must NOT have additional properties", params: { - missingProperty: "beforeTask", + additionalProperty: "afterTask", } }, { - dataPath: "/builder/customTasks/2", + instancePath: "/builder/customTasks/2", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } }, { - dataPath: "/server/settings/httpPort", + instancePath: "/server/settings/httpPort", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } }, { - dataPath: "/server/settings/httpsPort", + instancePath: "/server/settings/httpsPort", keyword: "type", - message: "should be number", + message: "must be number", params: { type: "number", } diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project/module.js b/packages/project/test/lib/validation/schema/specVersion/kind/project/module.js index 2899c22a040..3c121ab1ca2 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project/module.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project/module.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project-module"}); const thresholds = { - statements: 75, - branches: 65, + statements: 55, + branches: 55, functions: 100, - lines: 75 + lines: 55 }; t.context.ajvCoverage.verify(thresholds); }); @@ -75,9 +77,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { }, "framework": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "framework" } @@ -97,9 +99,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => { } } }, [{ - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "propertiesFileSourceEncoding" } @@ -117,9 +119,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.4").forEach((specVersion) => { }, "server": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "server" } @@ -135,9 +137,9 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.4").forEach((specVersion) => { }, "builder": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "builder" } @@ -215,25 +217,25 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings/includeDependency", + instancePath: "/builder/settings/includeDependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp", + instancePath: "/builder/settings/includeDependencyRegExp", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyTree", + instancePath: "/builder/settings/includeDependencyTree", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -267,81 +269,81 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings", + instancePath: "/builder/settings", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/settings/includeDependency/0", + instancePath: "/builder/settings/includeDependency/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/1", + instancePath: "/builder/settings/includeDependency/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/2", + instancePath: "/builder/settings/includeDependency/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + instancePath: "/builder/settings/includeDependencyRegExp/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + instancePath: "/builder/settings/includeDependencyRegExp/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", + instancePath: "/builder/settings/includeDependencyRegExp/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/0", + instancePath: "/builder/settings/includeDependencyTree/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/1", + instancePath: "/builder/settings/includeDependencyTree/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/2", + instancePath: "/builder/settings/includeDependencyTree/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -359,14 +361,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "illegal-🦜" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", } @@ -380,14 +382,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -401,14 +403,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a".repeat(81) } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, diff --git a/packages/project/test/lib/validation/schema/specVersion/kind/project/theme-library.js b/packages/project/test/lib/validation/schema/specVersion/kind/project/theme-library.js index 19bc8a09467..0ea1f564344 100644 --- a/packages/project/test/lib/validation/schema/specVersion/kind/project/theme-library.js +++ b/packages/project/test/lib/validation/schema/specVersion/kind/project/theme-library.js @@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -38,10 +40,10 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-project-theme-library"}); const thresholds = { - statements: 80, - branches: 70, + statements: 60, + branches: 55, functions: 100, - lines: 80 + lines: 60 }; t.context.ajvCoverage.verify(thresholds); }); @@ -133,33 +135,33 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach(function(specVersion) "libraryPreload": {}, } }, [{ - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "cachebuster" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "jsdoc" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "componentPreload" } }, { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload" } @@ -212,25 +214,25 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings/includeDependency", + instancePath: "/builder/settings/includeDependency", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp", + instancePath: "/builder/settings/includeDependencyRegExp", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/builder/settings/includeDependencyTree", + instancePath: "/builder/settings/includeDependencyTree", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -265,81 +267,81 @@ SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) } }, [ { - dataPath: "/builder/settings", + instancePath: "/builder/settings", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, }, { - dataPath: "/builder/settings/includeDependency/0", + instancePath: "/builder/settings/includeDependency/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/1", + instancePath: "/builder/settings/includeDependency/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependency/2", + instancePath: "/builder/settings/includeDependency/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + instancePath: "/builder/settings/includeDependencyRegExp/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + instancePath: "/builder/settings/includeDependencyRegExp/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", + instancePath: "/builder/settings/includeDependencyRegExp/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/0", + instancePath: "/builder/settings/includeDependencyTree/0", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/1", + instancePath: "/builder/settings/includeDependencyTree/1", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, }, { - dataPath: "/builder/settings/includeDependencyTree/2", + instancePath: "/builder/settings/includeDependencyTree/2", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -357,14 +359,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "illegal-🦜" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", }, @@ -378,14 +380,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a" } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -399,14 +401,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) "name": "a".repeat(81) } }, [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: `Not a valid project name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`, params: { errors: [{ - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, diff --git a/packages/project/test/lib/validation/schema/ui5-workspace.js b/packages/project/test/lib/validation/schema/ui5-workspace.js index 3bc5877542e..a5859026a60 100644 --- a/packages/project/test/lib/validation/schema/ui5-workspace.js +++ b/packages/project/test/lib/validation/schema/ui5-workspace.js @@ -17,9 +17,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -41,10 +43,10 @@ test.after.always((t) => { dir: "coverage/ajv-ui5-workspace", }); const thresholds = { - statements: 85, - branches: 75, + statements: 70, + branches: 65, functions: 100, - lines: 85, + lines: 70, }; t.context.ajvCoverage.verify(thresholds); }); @@ -57,7 +59,23 @@ test("Empty config", async (t) => { }, [ { - dataPath: "/specVersion", + instancePath: "", + keyword: "required", + message: "must have required property 'metadata'", + params: { + missingProperty: "metadata", + }, + }, + { + instancePath: "", + keyword: "required", + message: "must have required property 'dependencyManagement'", + params: { + missingProperty: "dependencyManagement", + }, + }, + { + instancePath: "/specVersion", keyword: "errorMessage", message: `Unsupported "specVersion" Your UI5 CLI installation might be outdated. @@ -66,10 +84,10 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp params: { errors: [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "enum", message: - "should be equal to one of the allowed values", + "must be equal to one of the allowed values", params: { allowedValues: ["workspace/1.0"], }, @@ -77,22 +95,6 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp ], }, }, - { - dataPath: "", - keyword: "required", - message: "should have required property 'metadata'", - params: { - missingProperty: "metadata", - }, - }, - { - dataPath: "", - keyword: "required", - message: "should have required property 'dependencyManagement'", - params: { - missingProperty: "dependencyManagement", - }, - }, ] ); }); @@ -132,9 +134,9 @@ test("Missing metadata.name", async (t) => { }, [ { - dataPath: "/metadata", + instancePath: "/metadata", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", }, @@ -161,15 +163,15 @@ test("Invalid metadata.name: Illegal characters", async (t) => { }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: "Not a valid workspace name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#name", params: { errors: [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, params: { pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", }, @@ -199,15 +201,15 @@ test("Invalid metadata.name: Too short", async (t) => { }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: "Not a valid workspace name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#name", params: { errors: [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "minLength", - message: "should NOT be shorter than 3 characters", + message: "must NOT have fewer than 3 characters", params: { limit: 3, }, @@ -238,15 +240,15 @@ test("Invalid metadata.name: Too long", async (t) => { }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: "Not a valid workspace name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#name", params: { errors: [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "maxLength", - message: "should NOT be longer than 80 characters", + message: "must NOT have more than 80 characters", params: { limit: 80, }, @@ -274,7 +276,7 @@ test("Invalid fields", async (t) => { }, [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: `Unsupported "specVersion" Your UI5 CLI installation might be outdated. @@ -283,10 +285,10 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp params: { errors: [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "enum", message: - "should be equal to one of the allowed values", + "must be equal to one of the allowed values", params: { allowedValues: ["workspace/1.0"], }, @@ -295,15 +297,15 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp }, }, { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: "Not a valid workspace name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#name", params: { errors: [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -312,17 +314,17 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp }, }, { - dataPath: "/dependencyManagement/resolutions", + instancePath: "/dependencyManagement/resolutions", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, }, { - dataPath: "/dependencyManagement/resolutions", + instancePath: "/dependencyManagement/resolutions", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "path", }, @@ -343,7 +345,7 @@ test("Invalid types", async (t) => { }, [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: `Unsupported "specVersion" Your UI5 CLI installation might be outdated. @@ -352,10 +354,10 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp params: { errors: [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "enum", message: - "should be equal to one of the allowed values", + "must be equal to one of the allowed values", params: { allowedValues: ["workspace/1.0"], }, @@ -364,15 +366,15 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp }, }, { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "errorMessage", message: "Not a valid workspace name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#name", params: { errors: [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, @@ -381,9 +383,9 @@ For details, see: https://ui5.github.io/cli/stable/pages/Workspace/#workspace-sp }, }, { - dataPath: "/dependencyManagement", + instancePath: "/dependencyManagement", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", }, @@ -406,9 +408,9 @@ test("Invalid dependencyManagement", async (t) => { }, [ { - dataPath: "/dependencyManagement/resolutions", + instancePath: "/dependencyManagement/resolutions", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -429,9 +431,9 @@ test("Invalid dependencyManagement", async (t) => { }, [ { - dataPath: "/dependencyManagement/resolutions/0", + instancePath: "/dependencyManagement/resolutions/0", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", }, @@ -452,9 +454,9 @@ test("Invalid dependencyManagement", async (t) => { }, [ { - dataPath: "/dependencyManagement/resolutions/0/path", + instancePath: "/dependencyManagement/resolutions/0/path", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string", }, diff --git a/packages/project/test/lib/validation/schema/ui5.js b/packages/project/test/lib/validation/schema/ui5.js index adf7cee71a9..30d90ddec3f 100644 --- a/packages/project/test/lib/validation/schema/ui5.js +++ b/packages/project/test/lib/validation/schema/ui5.js @@ -14,9 +14,11 @@ async function assertValidation(t, config, expectedErrors = undefined) { }); validationError.errors.forEach((error) => { delete error.schemaPath; + delete error.emUsed; if (error.params && Array.isArray(error.params.errors)) { error.params.errors.forEach(($) => { delete $.schemaPath; + delete $.emUsed; }); } }); @@ -36,19 +38,19 @@ test.before((t) => { test.after.always((t) => { t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-ui5"}); const thresholds = { - statements: 95, - branches: 80, + statements: 85, + branches: 70, functions: 100, - lines: 95 + lines: 85 }; t.context.ajvCoverage.verify(thresholds); }); test("Undefined", async (t) => { await assertValidation(t, undefined, [{ - dataPath: "", + instancePath: "", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } @@ -58,17 +60,17 @@ test("Undefined", async (t) => { test("Missing specVersion, type", async (t) => { await assertValidation(t, {}, [ { - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'specVersion'", + message: "must have required property 'specVersion'", params: { missingProperty: "specVersion", } }, { - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -82,9 +84,9 @@ test("Missing type", async (t) => { "specVersion": "2.0" }, [ { - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -97,7 +99,7 @@ test("Invalid specVersion", async (t) => { "specVersion": "0.0" }, [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: "Unsupported \"specVersion\"\n" + @@ -108,9 +110,9 @@ test("Invalid specVersion", async (t) => { params: { errors: [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "5.0", @@ -143,9 +145,9 @@ test("Invalid type", async (t) => { "type": "foo" }, [ { - dataPath: "/type", + instancePath: "/type", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "application", @@ -165,9 +167,9 @@ test("Invalid kind", async (t) => { "kind": "foo" }, [ { - dataPath: "/kind", + instancePath: "/kind", keyword: "enum", - message: "should be equal to one of the allowed values", + message: "must be equal to one of the allowed values", params: { allowedValues: [ "project", diff --git a/packages/project/test/utils/AjvCoverage.js b/packages/project/test/utils/AjvCoverage.js index 90ff01fc234..dfd683b14b2 100644 --- a/packages/project/test/utils/AjvCoverage.js +++ b/packages/project/test/utils/AjvCoverage.js @@ -7,10 +7,10 @@ import reports from "istanbul-reports"; import libCoverage from "istanbul-lib-coverage"; import {createInstrumenter} from "istanbul-lib-instrument"; -const rSchemaName = new RegExp(/sourceURL=([^\s]*)/); +const rSchemaName = new RegExp(/sourceURL="?([^"\s]*)"?/); const rRootDataUndefined = /\n(?:\s)*if \(rootData === undefined\) rootData = data;/g; const rEnsureErrorArray = /\n(?:\s)*if \(vErrors === null\) vErrors = \[err\];(?:\s)*else vErrors\.push\(err\);/g; -const rDataPathOrEmptyString = /dataPath: \(dataPath \|\| ''\)/g; +const rInstancePathOrEmptyString = /instancePath: \(instancePath \|\| ''\)/g; function hash(content) { return crypto.createHash("sha1").update(content).digest("hex").substr(0, 16); @@ -23,9 +23,12 @@ function randomCoverageVar() { class AjvCoverage { constructor(ajv, options = {}) { this.ajv = ajv; - this.ajv._opts.processCode = this._processCode.bind(this); + // In ajv v8, processCode is replaced with code.process + this.ajv.opts.code = this.ajv.opts.code || {}; + this.ajv.opts.code.process = this._processCode.bind(this); if (options.meta === true) { - this.ajv._metaOpts.processCode = this._processCode.bind(this); + this.ajv._metaOpts.code = this.ajv._metaOpts.code || {}; + this.ajv._metaOpts.code.process = this._processCode.bind(this); } this._processFileName = options.processFileName; this._includes = options.includes; @@ -110,7 +113,7 @@ class AjvCoverage { } else { // Probably a definition of a schema that is compiled separately // Try to find the schema that is currently compiling - const schemas = Object.entries(this.ajv._schemas); + const schemas = Object.entries(this.ajv.schemas); const compilingSchemas = schemas.filter(([, schema]) => schema.compiling); if (compilingSchemas.length > 0) { // Last schema is the current one @@ -137,7 +140,8 @@ class AjvCoverage { static insertIgnoreComments(code) { code = code.replace(rRootDataUndefined, "\n/* istanbul ignore next */$&"); code = code.replace(rEnsureErrorArray, "\n/* istanbul ignore next */$&"); - code = code.replace(rDataPathOrEmptyString, "dataPath: (dataPath || /* istanbul ignore next */ '')"); + code = code.replace(rInstancePathOrEmptyString, + "instancePath: (instancePath || /* istanbul ignore next */ '')"); return code; } }