diff --git a/lib/validation/ValidationError.js b/lib/validation/ValidationError.js index 609891f78..849cb07fd 100644 --- a/lib/validation/ValidationError.js +++ b/lib/validation/ValidationError.js @@ -72,8 +72,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) { @@ -99,7 +99,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; @@ -123,13 +123,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/lib/validation/schema/specVersion/2.0.json b/lib/validation/schema/specVersion/2.0.json index 9f2c563b1..1cf7e8236 100644 --- a/lib/validation/schema/specVersion/2.0.json +++ b/lib/validation/schema/specVersion/2.0.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion"], "properties": { - "specVersion": { "enum": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "$ref": "#/definitions/specVersions-2.x" }, "kind": { "enum": ["project", "extension", null], "$comment": "Using null to allow not defining 'kind' which defaults to project" @@ -33,5 +33,12 @@ "then": { "$ref": "2.0/kind/extension.json" } + }, + "definitions": { + "specVersions-2.x": { "enum": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "customConfiguration": { + "type": "object", + "additionalProperties": true + } } } diff --git a/lib/validation/schema/specVersion/2.0/kind/extension.json b/lib/validation/schema/specVersion/2.0/kind/extension.json index 8b2f679a7..59d84bef6 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "kind", "type", "metadata"], "properties": { - "specVersion": { "enum": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "$ref": "../../2.0.json#/definitions/specVersions-2.x" }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json b/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json index fedd06fb4..37935f36b 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json @@ -28,8 +28,7 @@ "$ref": "#/definitions/shims" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json b/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json index 4482680de..8c5ef4ca1 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json @@ -27,8 +27,7 @@ "$ref": "#/definitions/middleware" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/task.json b/lib/validation/schema/specVersion/2.0/kind/extension/task.json index a0cd872b0..17999e143 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/task.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/task.json @@ -26,8 +26,7 @@ "$ref": "#/definitions/task" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project.json b/lib/validation/schema/specVersion/2.0/kind/project.json index 8d3b8fb98..602d75d10 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project.json +++ b/lib/validation/schema/specVersion/2.0/kind/project.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "type"], "properties": { - "specVersion": { "enum": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "$ref": "../../2.0.json#/definitions/specVersions-2.x" }, "kind": { "enum": ["project", null], "$comment": "Using null to allow not defining 'kind' which defaults to project" @@ -113,7 +113,6 @@ }, "builder-bundles": { "type": "array", - "additionalProperties": false, "items": { "type": "object", "additionalProperties": false, @@ -184,7 +183,6 @@ }, "builder-bundles-2.4": { "type": "array", - "additionalProperties": false, "items": { "type": "object", "additionalProperties": false, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/application.json b/lib/validation/schema/specVersion/2.0/kind/project/application.json index 15af57a58..d0cbddf70 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/application.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/application.json @@ -35,8 +35,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -72,8 +71,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -109,8 +107,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -146,8 +143,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/library.json b/lib/validation/schema/specVersion/2.0/kind/project/library.json index 6c624e64f..f0a377338 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/library.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/library.json @@ -35,8 +35,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -72,8 +71,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -109,8 +107,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -146,8 +143,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/module.json b/lib/validation/schema/specVersion/2.0/kind/project/module.json index 44b9063bc..709259dcc 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/module.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/module.json @@ -32,8 +32,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -60,8 +59,7 @@ "$ref": "#/definitions/resources" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json b/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json index 41a61f2fa..31ff6f0aa 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json @@ -35,8 +35,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, @@ -72,8 +71,7 @@ "$ref": "../project.json#/definitions/server" }, "customConfiguration": { - "type": "object", - "additionalProperties": true + "$ref": "../../../2.0.json#/definitions/customConfiguration" } } }, diff --git a/lib/validation/schema/ui5.json b/lib/validation/schema/ui5.json index fa249710e..e94cffda6 100644 --- a/lib/validation/schema/ui5.json +++ b/lib/validation/schema/ui5.json @@ -19,7 +19,7 @@ "if": { "properties": { - "specVersion": { "enum": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] } + "specVersion": { "$ref": "specVersion/2.0.json#/definitions/specVersions-2.x" } } }, "then": { diff --git a/lib/validation/validator.js b/lib/validation/validator.js index bdee5de46..233aada5e 100644 --- a/lib/validation/validator.js +++ b/lib/validation/validator.js @@ -17,8 +17,10 @@ class Validator { const Ajv = require("ajv"); this.ajv = new Ajv({ allErrors: true, - jsonPointers: true, - loadSchema + loadSchema, + code: { + optimize: false + } }); const ajvErrors = require("ajv-errors"); ajvErrors(this.ajv); diff --git a/package-lock.json b/package-lock.json index edd6f4bdb..b24f686ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -407,6 +407,18 @@ "strip-json-comments": "^3.1.1" }, "dependencies": { + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -452,6 +464,12 @@ "esprima": "^4.0.0" } }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -888,20 +906,20 @@ } }, "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.6.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz", + "integrity": "sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==", "requires": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, "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==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==" }, "ansi-align": { "version": "3.0.1", @@ -2853,6 +2871,18 @@ "@babel/highlight": "^7.10.4" } }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -2918,6 +2948,12 @@ "esprima": "^4.0.0" } }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3185,7 +3221,8 @@ "fast-json-stable-stringify": { "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==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -4244,9 +4281,9 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "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==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -6176,8 +6213,7 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, "require-main-filename": { "version": "2.0.0", diff --git a/package.json b/package.json index ba22c976b..563915b4e 100644 --- a/package.json +++ b/package.json @@ -104,8 +104,8 @@ "@ui5/builder": "^2.10.0", "@ui5/logger": "^2.0.1", "@ui5/server": "^2.3.1", - "ajv": "^6.12.6", - "ajv-errors": "^1.0.1", + "ajv": "^8.6.3", + "ajv-errors": "^3.0.0", "chalk": "^4.1.2", "escape-string-regexp": "^4.0.0", "graceful-fs": "^4.2.8", diff --git a/test/lib/projectPreprocessor.js b/test/lib/projectPreprocessor.js index 9876838ea..32c2df712 100644 --- a/test/lib/projectPreprocessor.js +++ b/test/lib/projectPreprocessor.js @@ -1635,7 +1635,7 @@ test("specVersion: Project with invalid version", async (t) => { }); t.is(validationError.errors.length, 1, "ValidationError should have one error object"); - t.is(validationError.errors[0].dataPath, "/specVersion", "Error should be for the specVersion"); + t.is(validationError.errors[0].instancePath, "/specVersion", "Error should be for the specVersion"); }); test("specVersion: Project with valid version 0.1", async (t) => { diff --git a/test/lib/validation/ValidationError.js b/test/lib/validation/ValidationError.js index e53f3cee2..b5d25e50a 100644 --- a/test/lib/validation/ValidationError.js +++ b/test/lib/validation/ValidationError.js @@ -10,15 +10,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); @@ -53,37 +53,37 @@ test.serial("ValidationError.filterErrors", (t) => { keyword: "if" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword2" }, { - dataPath: "dataPath3", + instancePath: "instancePath3", keyword: "keyword2" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword1", params: { type: "foo" } }, { - dataPath: "dataPath4", + instancePath: "instancePath4", keyword: "keyword5", params: { type: "foo" } }, { - dataPath: "dataPath6", + instancePath: "instancePath6", keyword: "keyword6", params: { errors: [ @@ -97,7 +97,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "instancePath6", keyword: "keyword6", params: { errors: [ @@ -111,7 +111,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "instancePath6", keyword: "keyword6", params: { errors: [ @@ -128,33 +128,33 @@ test.serial("ValidationError.filterErrors", (t) => { const expectedErrors = [ { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword1" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword2" }, { - dataPath: "dataPath3", + instancePath: "instancePath3", keyword: "keyword2" }, { - dataPath: "dataPath1", + instancePath: "instancePath1", keyword: "keyword1", params: { type: "foo" } }, { - dataPath: "dataPath4", + instancePath: "instancePath4", keyword: "keyword5", params: { type: "foo" } }, { - dataPath: "dataPath6", + instancePath: "instancePath6", keyword: "keyword6", params: { errors: [ @@ -168,7 +168,7 @@ test.serial("ValidationError.filterErrors", (t) => { } }, { - dataPath: "dataPath6", + instancePath: "instancePath6", keyword: "keyword6", params: { errors: [ @@ -322,7 +322,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: @@ -342,7 +342,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: @@ -361,7 +361,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: @@ -381,7 +381,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: @@ -406,7 +406,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: @@ -430,7 +430,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: @@ -446,7 +446,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: @@ -466,7 +466,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: @@ -486,7 +486,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,8 +505,8 @@ test.serial("ValidationError.analyzeYamlError: Nested properties with same name" "analyzeYamlError should return expected results"); }); -test.serial("ValidationError.analyzeYamlError: Error keyword=required, no dataPath", (t) => { - const error = {dataPath: "", keyword: "required"}; +test.serial("ValidationError.analyzeYamlError: Error keyword=required, no instancePath", (t) => { + const error = {instancePath: "", keyword: "required"}; const yaml = { path: "/my-project/ui5.yaml", source: ``, @@ -520,7 +520,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: @@ -539,7 +539,7 @@ property2: test.serial("ValidationError.analyzeYamlError: Error keyword=additionalProperties", (t) => { const error = { - dataPath: "/property2", + instancePath: "/property2", keyword: "additionalProperties", params: { additionalProperty: "property3" @@ -562,7 +562,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: @@ -587,7 +587,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: @@ -613,7 +613,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: @@ -643,7 +643,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: @@ -675,7 +675,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: @@ -708,7 +708,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: @@ -746,7 +746,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: @@ -767,7 +767,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: @@ -786,11 +786,11 @@ property5: value5document1 "analyzeYamlError should return expected results"); }); -test.serial("ValidationError.formatMessage: keyword=type dataPath=", (t) => { +test.serial("ValidationError.formatMessage: keyword=type instancePath=", (t) => { const error = { - dataPath: "", + instancePath: "", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", }, @@ -805,9 +805,9 @@ 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", + message: "must be object", params: { type: "object", }, @@ -820,11 +820,11 @@ test.serial("ValidationError.formatMessage: keyword=type", (t) => { t.is(errorMessage, expectedErrorMessage); }); -test.serial("ValidationError.formatMessage: keyword=required w/o dataPath", (t) => { +test.serial("ValidationError.formatMessage: keyword=required w/o instancePath", (t) => { const error = { - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'specVersion'", + message: "must have required property 'specVersion'", params: { missingProperty: "specVersion", }, @@ -840,10 +840,10 @@ 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'" + message: "must have required property 'name'" }; const expectedErrorMessage = @@ -855,7 +855,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" @@ -865,9 +865,9 @@ For details see: https://sap.github.io/ui5-tooling/pages/Configuration/#specific 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: [ "2.0", @@ -896,10 +896,10 @@ For details see: https://sap.github.io/ui5-tooling/pages/Configuration/#specific 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" + message: "must NOT have additional properties" }; const expectedErrorMessage = @@ -913,12 +913,12 @@ 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"] }, - message: "should be equal to one of the allowed values" + message: "must be equal to one of the allowed values" }; const expectedErrorMessage = diff --git a/test/lib/validation/schema/__helper__/customConfiguration.js b/test/lib/validation/schema/__helper__/customConfiguration.js index 184e984bd..e5a9b724b 100644 --- a/test/lib/validation/schema/__helper__/customConfiguration.js +++ b/test/lib/validation/schema/__helper__/customConfiguration.js @@ -25,9 +25,9 @@ module.exports = { "customConfiguration": {} }, additionalConfiguration), [ { - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "customConfiguration", } diff --git a/test/lib/validation/schema/__helper__/extension.js b/test/lib/validation/schema/__helper__/extension.js index cfe07820e..148b4e8d8 100644 --- a/test/lib/validation/schema/__helper__/extension.js +++ b/test/lib/validation/schema/__helper__/extension.js @@ -38,9 +38,9 @@ module.exports = { }, "resources": {} }, additionalConfiguration), [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "resources" } @@ -57,9 +57,9 @@ module.exports = { }, "notAllowed": true }, additionalConfiguration), [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", } diff --git a/test/lib/validation/schema/__helper__/framework.js b/test/lib/validation/schema/__helper__/framework.js index 70bc9919c..cbe0ec18a 100644 --- a/test/lib/validation/schema/__helper__/framework.js +++ b/test/lib/validation/schema/__helper__/framework.js @@ -81,9 +81,9 @@ module.exports = { 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", @@ -92,16 +92,17 @@ module.exports = { } }, { - 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", + emUsed: true, + 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: { @@ -115,41 +116,41 @@ module.exports = { } }, { - 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" } @@ -167,9 +168,9 @@ module.exports = { "framework": {} }, [ { - dataPath: "/framework", + instancePath: "/framework", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name" } @@ -204,23 +205,25 @@ module.exports = { } }, [ { - 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", + emUsed: true, + 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", + emUsed: true, + instancePath: "/framework/libraries/0", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "optional", } @@ -229,17 +232,17 @@ module.exports = { } }, { - 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/test/lib/validation/schema/__helper__/project.js b/test/lib/validation/schema/__helper__/project.js index eafad2afe..6af6e9e7a 100644 --- a/test/lib/validation/schema/__helper__/project.js +++ b/test/lib/validation/schema/__helper__/project.js @@ -30,9 +30,9 @@ module.exports = { "specVersion": specVersion, "type": type }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'metadata'", + message: "must have required property 'metadata'", params: { missingProperty: "metadata", } @@ -45,9 +45,9 @@ module.exports = { "type": type, "metadata": "foo" }, [{ - dataPath: "/metadata", + instancePath: "/metadata", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } @@ -60,9 +60,9 @@ module.exports = { "type": type, "metadata": {} }, [{ - dataPath: "/metadata", + instancePath: "/metadata", keyword: "required", - message: "should have required property 'name'", + message: "must have required property 'name'", params: { missingProperty: "name", } @@ -78,9 +78,9 @@ module.exports = { } }, [ { - dataPath: "/metadata/name", + instancePath: "/metadata/name", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -98,9 +98,9 @@ module.exports = { } }, [ { - dataPath: "/metadata/copyright", + instancePath: "/metadata/copyright", keyword: "type", - message: "should be string", + message: "must be string", params: { type: "string" } @@ -118,9 +118,9 @@ module.exports = { } }, [ { - dataPath: "/metadata", + instancePath: "/metadata", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "copyrihgt" } @@ -160,9 +160,9 @@ module.exports = { } }, [ { - dataPath: "/metadata/deprecated", + instancePath: "/metadata/deprecated", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -202,9 +202,9 @@ module.exports = { } }, [ { - dataPath: "/metadata/sapInternal", + instancePath: "/metadata/sapInternal", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -244,9 +244,9 @@ module.exports = { } }, [ { - dataPath: "/metadata/allowSapInternal", + instancePath: "/metadata/allowSapInternal", keyword: "type", - message: "should be boolean", + message: "must be boolean", params: { type: "boolean", } @@ -263,9 +263,9 @@ module.exports = { }, "notAllowed": true }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "notAllowed", }, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension.js b/test/lib/validation/schema/specVersion/2.0/kind/extension.js index 41eaa279f..3618093cf 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/extension.js @@ -85,9 +85,9 @@ test.after.always((t) => { "name": "my-project" } }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'type'", + message: "must have required property 'type'", params: { missingProperty: "type", } @@ -103,9 +103,9 @@ test.after.always((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: [ "task", @@ -125,9 +125,9 @@ test.after.always((t) => { }, "shims": {} }, [{ - dataPath: "", + instancePath: "", keyword: "required", - message: "should have required property 'specVersion'", + message: "must have required property 'specVersion'", params: { missingProperty: "specVersion", } @@ -141,9 +141,9 @@ test.after.always((t) => { "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/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js b/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js index 133144e5f..328dd8c5e 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js @@ -77,41 +77,41 @@ test.after.always((t) => { "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", } diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project.js b/test/lib/validation/schema/specVersion/2.0/kind/project.js index d02ef6cc4..139a2c63b 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project.js @@ -129,9 +129,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", } @@ -145,9 +145,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", } @@ -163,9 +163,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", @@ -185,9 +185,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/test/lib/validation/schema/specVersion/2.0/kind/project/application.js b/test/lib/validation/schema/specVersion/2.0/kind/project/application.js index e3a587829..cf8e3586e 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/application.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/application.js @@ -223,25 +223,25 @@ test.after.always((t) => { } }, [ { - 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", @@ -250,17 +250,17 @@ test.after.always((t) => { } }, { - 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" } @@ -279,9 +279,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/resources/configuration/paths", + instancePath: "/resources/configuration/paths", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object" } @@ -365,73 +365,73 @@ test.after.always((t) => { } }, [ { - 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: ["2.5", "2.4"].includes(specVersion) ? [ "raw", @@ -448,57 +448,57 @@ test.after.always((t) => { } }, { - 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", } @@ -526,9 +526,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "excludes", }, @@ -572,9 +572,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder/componentPreload/excludes", + instancePath: "/builder/componentPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -599,33 +599,33 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -707,25 +707,25 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -760,81 +760,81 @@ test.after.always((t) => { } }, [ { - 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", }, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/library.js b/test/lib/validation/schema/specVersion/2.0/kind/project/library.js index ce4e8facb..ccf4961fb 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/library.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/library.js @@ -296,9 +296,9 @@ test.after.always((t) => { } }, [ { - 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", @@ -307,97 +307,97 @@ test.after.always((t) => { } }, { - 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: ["2.5", "2.4"].includes(specVersion) ? [ "raw", @@ -414,121 +414,121 @@ test.after.always((t) => { } }, { - 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", } @@ -552,9 +552,9 @@ test.after.always((t) => { } }; 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" } @@ -576,9 +576,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder", + instancePath: "/builder", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "libraryPreload", }, @@ -603,9 +603,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder/componentPreload", + instancePath: "/builder/componentPreload", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { additionalProperty: "excludes", }, @@ -649,9 +649,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder/libraryPreload/excludes", + instancePath: "/builder/libraryPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -676,33 +676,33 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -745,9 +745,9 @@ test.after.always((t) => { } }, [ { - dataPath: "/builder/componentPreload/excludes", + instancePath: "/builder/componentPreload/excludes", keyword: "type", - message: "should be array", + message: "must be array", params: { type: "array", }, @@ -772,33 +772,33 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -880,25 +880,25 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -933,81 +933,81 @@ test.after.always((t) => { } }, [ { - 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", }, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/module.js b/test/lib/validation/schema/specVersion/2.0/kind/project/module.js index 3deb5f313..8e3af9c51 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/module.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/module.js @@ -67,9 +67,9 @@ test.after.always((t) => { }, "framework": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "framework" } @@ -89,9 +89,9 @@ test.after.always((t) => { } } }, [{ - dataPath: "/resources/configuration", + instancePath: "/resources/configuration", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "propertiesFileSourceEncoding" } @@ -109,9 +109,9 @@ test.after.always((t) => { }, "server": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "server" } @@ -127,9 +127,9 @@ test.after.always((t) => { }, "builder": {} }, [{ - dataPath: "", + instancePath: "", keyword: "additionalProperties", - message: "should NOT have additional properties", + message: "must NOT have additional properties", params: { "additionalProperty": "builder" } @@ -207,25 +207,25 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -259,81 +259,81 @@ test.after.always((t) => { } }, [ { - 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", }, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js b/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js index c6d5cfd19..04ba5579e 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js @@ -131,33 +131,33 @@ test.after.always((t) => { "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" } @@ -210,25 +210,25 @@ test.after.always((t) => { } }, [ { - 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", }, @@ -263,81 +263,81 @@ test.after.always((t) => { } }, [ { - 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", }, diff --git a/test/lib/validation/schema/ui5.js b/test/lib/validation/schema/ui5.js index 483a38bad..eabb475ab 100644 --- a/test/lib/validation/schema/ui5.js +++ b/test/lib/validation/schema/ui5.js @@ -44,9 +44,9 @@ test.after.always((t) => { test("Undefined", async (t) => { await assertValidation(t, undefined, [{ - dataPath: "", + instancePath: "", keyword: "type", - message: "should be object", + message: "must be object", params: { type: "object", } @@ -56,17 +56,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", } @@ -80,9 +80,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", } @@ -95,7 +95,7 @@ test("Invalid specVersion", async (t) => { "specVersion": "0.0" }, [ { - dataPath: "/specVersion", + instancePath: "/specVersion", keyword: "errorMessage", message: `Unsupported "specVersion" @@ -105,9 +105,10 @@ For details see: https://sap.github.io/ui5-tooling/pages/Configuration/#specific 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: [ "2.5", @@ -134,9 +135,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", @@ -155,9 +156,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/test/utils/AjvCoverage.js b/test/utils/AjvCoverage.js index e674c8d67..efdcf0527 100644 --- a/test/utils/AjvCoverage.js +++ b/test/utils/AjvCoverage.js @@ -7,11 +7,8 @@ const reports = require("istanbul-reports"); const libCoverage = require("istanbul-lib-coverage"); const {createInstrumenter} = require("istanbul-lib-instrument"); -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 rEnsureErrorArray = /\n(?:\s)*if \(vErrors === null\) {(?:\s)*vErrors = \[err[0-9]*\];(?:\s)*} else {(?:\s)*vErrors\.push\(err[0-9]*\);/g; function hash(content) { return crypto.createHash("sha1").update(content).digest("hex").substr(0, 16); @@ -24,9 +21,9 @@ function randomCoverageVar() { class AjvCoverage { constructor(ajv, options = {}) { this.ajv = ajv; - this.ajv._opts.processCode = this._processCode.bind(this); + 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.process = this._processCode.bind(this); } this._processFileName = options.processFileName; this._includes = options.includes; @@ -103,24 +100,8 @@ class AjvCoverage { _createCoverageMap() { return libCoverage.createCoverageMap(global[this._globalCoverageVar]); } - _processCode(originalCode) { - let fileName; - const schemaNameMatch = rSchemaName.exec(originalCode); - if (schemaNameMatch) { - fileName = schemaNameMatch[1]; - } 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 compilingSchemas = schemas.filter(([, schema]) => schema.compiling); - if (compilingSchemas.length > 0) { - // Last schema is the current one - const lastSchemaEntry = compilingSchemas[compilingSchemas.length - 1]; - fileName = lastSchemaEntry[0] + "-" + hash(originalCode); - } else { - fileName = hash(originalCode); - } - } + _processCode(originalCode, schemaEnv) { + let fileName = schemaEnv.baseId + "-" + schemaEnv.validateName.str; if (typeof this._processFileName === "function") { fileName = this._processFileName.call(null, fileName); @@ -138,7 +119,6 @@ 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 */ '')"); return code; } }