diff --git a/lib/specifications/SpecificationVersion.js b/lib/specifications/SpecificationVersion.js index 2634fe944..b8839d3bf 100644 --- a/lib/specifications/SpecificationVersion.js +++ b/lib/specifications/SpecificationVersion.js @@ -4,7 +4,7 @@ const SPEC_VERSION_PATTERN = /^\d+\.\d+$/; const SUPPORTED_VERSIONS = [ "0.1", "1.0", "1.1", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", - "3.0", "3.1" + "3.0", "3.1", "3.2" ]; /** diff --git a/lib/validation/schema/specVersion/kind/extension.json b/lib/validation/schema/specVersion/kind/extension.json index 633aaea6b..39d65c800 100644 --- a/lib/validation/schema/specVersion/kind/extension.json +++ b/lib/validation/schema/specVersion/kind/extension.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "kind", "type", "metadata"], "properties": { - "specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["3.2", "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/kind/extension/project-shim.json b/lib/validation/schema/specVersion/kind/extension/project-shim.json index cb5a4dbfa..177844657 100644 --- a/lib/validation/schema/specVersion/kind/extension/project-shim.json +++ b/lib/validation/schema/specVersion/kind/extension/project-shim.json @@ -6,14 +6,14 @@ "required": ["specVersion", "kind", "type", "metadata", "shims"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.0", "3.1", "3.2"] } } }, "then": { "additionalProperties": false, "properties": { "specVersion": { - "enum": ["3.0", "3.1"] + "enum": ["3.0", "3.1", "3.2"] }, "kind": { "enum": ["extension"] diff --git a/lib/validation/schema/specVersion/kind/extension/server-middleware.json b/lib/validation/schema/specVersion/kind/extension/server-middleware.json index 1b46323be..980793eab 100644 --- a/lib/validation/schema/specVersion/kind/extension/server-middleware.json +++ b/lib/validation/schema/specVersion/kind/extension/server-middleware.json @@ -7,13 +7,13 @@ "required": ["specVersion", "kind", "type", "metadata", "middleware"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.0", "3.1", "3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.0", "3.1"] }, + "specVersion": { "enum": ["3.0", "3.1", "3.2"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/kind/extension/task.json b/lib/validation/schema/specVersion/kind/extension/task.json index 7e02c82eb..d77439db9 100644 --- a/lib/validation/schema/specVersion/kind/extension/task.json +++ b/lib/validation/schema/specVersion/kind/extension/task.json @@ -6,13 +6,13 @@ "required": ["specVersion", "kind", "type", "metadata", "task"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.0", "3.1", "3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.0", "3.1"] }, + "specVersion": { "enum": ["3.0", "3.1", "3.2"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/kind/project.json b/lib/validation/schema/specVersion/kind/project.json index 65191e05f..48ae92186 100644 --- a/lib/validation/schema/specVersion/kind/project.json +++ b/lib/validation/schema/specVersion/kind/project.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "type"], "properties": { - "specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["3.2", "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, "kind": { "enum": ["project", null], "$comment": "Using null to allow not defining 'kind' which defaults to project" @@ -191,6 +191,22 @@ } } }, + "builder-bundles-3.2": { + "type": "array", + "additionalProperties": false, + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "bundleDefinition": { + "$ref": "#/definitions/builder-bundles-bundleDefinition-3.2" + }, + "bundleOptions": { + "$ref": "#/definitions/builder-bundles-bundleOptions-3.0" + } + } + } + }, "builder-bundles-bundleDefinition": { "type": "object", "additionalProperties": false, @@ -307,6 +323,64 @@ } } }, + "builder-bundles-bundleDefinition-3.2": { + "type": "object", + "additionalProperties": false, + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "defaultFileTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "sections": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": ["mode", "filters"], + "properties": { + "name": { + "type": "string" + }, + "mode": { + "enum": ["raw", "preload", "require", "provided", "bundleInfo", "depCache"] + }, + "filters": { + "type": "array", + "items": { + "type": "string" + } + }, + "resolve": { + "type": "boolean", + "default": false + }, + "resolveConditional": { + "type": "boolean", + "default": false + }, + "renderer": { + "type": "boolean", + "default": false + }, + "sort": { + "type": "boolean", + "default": true + }, + "declareRawModules": { + "type": "boolean", + "default": false + } + } + } + } + } + }, "builder-bundles-bundleOptions": { "type": "object", "additionalProperties": false, diff --git a/lib/validation/schema/specVersion/kind/project/application.json b/lib/validation/schema/specVersion/kind/project/application.json index 1091be04e..416d8479c 100644 --- a/lib/validation/schema/specVersion/kind/project/application.json +++ b/lib/validation/schema/specVersion/kind/project/application.json @@ -6,13 +6,13 @@ "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.0", "3.1"] }, + "specVersion": { "enum": ["3.2"] }, "kind": { "enum": ["project", null] }, @@ -29,7 +29,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-3.0" + "$ref": "#/definitions/builder-specVersion-3.2" }, "server": { "$ref": "../project.json#/definitions/server" @@ -39,18 +39,18 @@ "additionalProperties": true } } - }, + }, "else": { "if": { "properties": { - "specVersion": { "enum": ["2.6"] } + "specVersion": { "enum": ["3.0", "3.1"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.6"] }, + "specVersion": { "enum": ["3.0", "3.1"] }, "kind": { "enum": ["project", null] }, @@ -58,7 +58,7 @@ "enum": ["application"] }, "metadata": { - "$ref": "../project.json#/definitions/metadata" + "$ref": "../project.json#/definitions/metadata-3.0" }, "framework": { "$ref": "../project.json#/definitions/framework" @@ -67,7 +67,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.6" + "$ref": "#/definitions/builder-specVersion-3.0" }, "server": { "$ref": "../project.json#/definitions/server" @@ -81,13 +81,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.5"] } + "specVersion": { "enum": ["2.6"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.5"] }, + "specVersion": { "enum": ["2.6"] }, "kind": { "enum": ["project", null] }, @@ -104,7 +104,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.5" + "$ref": "#/definitions/builder-specVersion-2.6" }, "server": { "$ref": "../project.json#/definitions/server" @@ -118,13 +118,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.4"] } + "specVersion": { "enum": ["2.5"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.4"] }, + "specVersion": { "enum": ["2.5"] }, "kind": { "enum": ["project", null] }, @@ -141,7 +141,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.4" + "$ref": "#/definitions/builder-specVersion-2.5" }, "server": { "$ref": "../project.json#/definitions/server" @@ -155,13 +155,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.3"] } + "specVersion": { "enum": ["2.4"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.3"] }, + "specVersion": { "enum": ["2.4"] }, "kind": { "enum": ["project", null] }, @@ -178,7 +178,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.3" + "$ref": "#/definitions/builder-specVersion-2.4" }, "server": { "$ref": "../project.json#/definitions/server" @@ -192,13 +192,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.1", "2.2"] } + "specVersion": { "enum": ["2.3"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1", "2.2"] }, + "specVersion": { "enum": ["2.3"] }, "kind": { "enum": ["project", null] }, @@ -215,7 +215,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder" + "$ref": "#/definitions/builder-specVersion-2.3" }, "server": { "$ref": "../project.json#/definitions/server" @@ -227,29 +227,67 @@ } }, "else": { - "additionalProperties": false, - "properties": { - "specVersion": { "enum": ["2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["application"] - }, - "metadata": { - "$ref": "../project.json#/definitions/metadata" - }, - "framework": { - "$ref": "../project.json#/definitions/framework" - }, - "resources": { - "$ref": "#/definitions/resources" - }, - "builder": { - "$ref": "#/definitions/builder" - }, - "server": { - "$ref": "../project.json#/definitions/server" + "if": { + "properties": { + "specVersion": { "enum": ["2.1", "2.2"] } + } + }, + "then": { + "additionalProperties": false, + "properties": { + "specVersion": { "enum": ["2.1", "2.2"] }, + "kind": { + "enum": ["project", null] + }, + "type": { + "enum": ["application"] + }, + "metadata": { + "$ref": "../project.json#/definitions/metadata" + }, + "framework": { + "$ref": "../project.json#/definitions/framework" + }, + "resources": { + "$ref": "#/definitions/resources" + }, + "builder": { + "$ref": "#/definitions/builder" + }, + "server": { + "$ref": "../project.json#/definitions/server" + }, + "customConfiguration": { + "type": "object", + "additionalProperties": true + } + } + }, + "else": { + "additionalProperties": false, + "properties": { + "specVersion": { "enum": ["2.0"] }, + "kind": { + "enum": ["project", null] + }, + "type": { + "enum": ["application"] + }, + "metadata": { + "$ref": "../project.json#/definitions/metadata" + }, + "framework": { + "$ref": "../project.json#/definitions/framework" + }, + "resources": { + "$ref": "#/definitions/resources" + }, + "builder": { + "$ref": "#/definitions/builder" + }, + "server": { + "$ref": "../project.json#/definitions/server" + } } } } @@ -462,6 +500,39 @@ "$ref": "../project.json#/definitions/builder-settings" } } + }, + "builder-specVersion-3.2": { + "type": "object", + "additionalProperties": false, + "properties": { + "resources": { + "$ref": "../project.json#/definitions/builder-resources" + }, + "cachebuster": { + "type": "object", + "additionalProperties": false, + "properties": { + "signatureType": { + "enum": ["time", "hash"] + } + } + }, + "bundles": { + "$ref": "../project.json#/definitions/builder-bundles-3.2" + }, + "componentPreload": { + "$ref": "../project.json#/definitions/builder-componentPreload-specVersion-2.3" + }, + "customTasks": { + "$ref": "../project.json#/definitions/customTasks" + }, + "minification": { + "$ref": "../project.json#/definitions/builder-minification" + }, + "settings": { + "$ref": "../project.json#/definitions/builder-settings" + } + } } } } diff --git a/lib/validation/schema/specVersion/kind/project/library.json b/lib/validation/schema/specVersion/kind/project/library.json index d5114b633..84c71a0bd 100644 --- a/lib/validation/schema/specVersion/kind/project/library.json +++ b/lib/validation/schema/specVersion/kind/project/library.json @@ -6,13 +6,13 @@ "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.0", "3.1"] }, + "specVersion": { "enum": ["3.2"] }, "kind": { "enum": ["project", null] }, @@ -29,7 +29,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-3.0" + "$ref": "#/definitions/builder-specVersion-3.2" }, "server": { "$ref": "../project.json#/definitions/server" @@ -43,13 +43,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.6"] } + "specVersion": { "enum": ["3.0", "3.1"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.6"] }, + "specVersion": { "enum": ["3.0", "3.1"] }, "kind": { "enum": ["project", null] }, @@ -57,7 +57,7 @@ "enum": ["library"] }, "metadata": { - "$ref": "../project.json#/definitions/metadata" + "$ref": "../project.json#/definitions/metadata-3.0" }, "framework": { "$ref": "../project.json#/definitions/framework" @@ -66,7 +66,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.6" + "$ref": "#/definitions/builder-specVersion-3.0" }, "server": { "$ref": "../project.json#/definitions/server" @@ -80,13 +80,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.5"] } + "specVersion": { "enum": ["2.6"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.5"] }, + "specVersion": { "enum": ["2.6"] }, "kind": { "enum": ["project", null] }, @@ -103,7 +103,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.5" + "$ref": "#/definitions/builder-specVersion-2.6" }, "server": { "$ref": "../project.json#/definitions/server" @@ -117,13 +117,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.4"] } + "specVersion": { "enum": ["2.5"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.4"] }, + "specVersion": { "enum": ["2.5"] }, "kind": { "enum": ["project", null] }, @@ -140,7 +140,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.4" + "$ref": "#/definitions/builder-specVersion-2.5" }, "server": { "$ref": "../project.json#/definitions/server" @@ -154,13 +154,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.3"] } + "specVersion": { "enum": ["2.4"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.3"] }, + "specVersion": { "enum": ["2.4"] }, "kind": { "enum": ["project", null] }, @@ -177,7 +177,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.3" + "$ref": "#/definitions/builder-specVersion-2.4" }, "server": { "$ref": "../project.json#/definitions/server" @@ -191,13 +191,13 @@ "else": { "if": { "properties": { - "specVersion": { "enum": ["2.1", "2.2"] } + "specVersion": { "enum": ["2.3"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1", "2.2"] }, + "specVersion": { "enum": ["2.3"] }, "kind": { "enum": ["project", null] }, @@ -214,7 +214,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder" + "$ref": "#/definitions/builder-specVersion-2.3" }, "server": { "$ref": "../project.json#/definitions/server" @@ -226,29 +226,67 @@ } }, "else": { - "additionalProperties": false, - "properties": { - "specVersion": { "enum": ["2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["library"] - }, - "metadata": { - "$ref": "../project.json#/definitions/metadata" - }, - "framework": { - "$ref": "../project.json#/definitions/framework" - }, - "resources": { - "$ref": "#/definitions/resources" - }, - "builder": { - "$ref": "#/definitions/builder" - }, - "server": { - "$ref": "../project.json#/definitions/server" + "if": { + "properties": { + "specVersion": { "enum": ["2.1", "2.2"] } + } + }, + "then": { + "additionalProperties": false, + "properties": { + "specVersion": { "enum": ["2.1", "2.2"] }, + "kind": { + "enum": ["project", null] + }, + "type": { + "enum": ["library"] + }, + "metadata": { + "$ref": "../project.json#/definitions/metadata" + }, + "framework": { + "$ref": "../project.json#/definitions/framework" + }, + "resources": { + "$ref": "#/definitions/resources" + }, + "builder": { + "$ref": "#/definitions/builder" + }, + "server": { + "$ref": "../project.json#/definitions/server" + }, + "customConfiguration": { + "type": "object", + "additionalProperties": true + } + } + }, + "else": { + "additionalProperties": false, + "properties": { + "specVersion": { "enum": ["2.0"] }, + "kind": { + "enum": ["project", null] + }, + "type": { + "enum": ["library"] + }, + "metadata": { + "$ref": "../project.json#/definitions/metadata" + }, + "framework": { + "$ref": "../project.json#/definitions/framework" + }, + "resources": { + "$ref": "#/definitions/resources" + }, + "builder": { + "$ref": "#/definitions/builder" + }, + "server": { + "$ref": "../project.json#/definitions/server" + } } } } @@ -452,6 +490,36 @@ "$ref": "../project.json#/definitions/builder-settings" } } + }, + "builder-specVersion-3.2": { + "type": "object", + "additionalProperties": false, + "properties": { + "resources": { + "$ref": "../project.json#/definitions/builder-resources" + }, + "jsdoc": { + "$ref": "#/definitions/builder-jsdoc" + }, + "bundles": { + "$ref": "../project.json#/definitions/builder-bundles-3.2" + }, + "componentPreload": { + "$ref": "../project.json#/definitions/builder-componentPreload-specVersion-2.3" + }, + "libraryPreload": { + "$ref": "../project.json#/definitions/builder-libraryPreload" + }, + "customTasks": { + "$ref": "../project.json#/definitions/customTasks" + }, + "minification": { + "$ref": "../project.json#/definitions/builder-minification" + }, + "settings": { + "$ref": "../project.json#/definitions/builder-settings" + } + } } } } diff --git a/lib/validation/schema/specVersion/kind/project/module.json b/lib/validation/schema/specVersion/kind/project/module.json index e6fe250b8..d220cd9a6 100644 --- a/lib/validation/schema/specVersion/kind/project/module.json +++ b/lib/validation/schema/specVersion/kind/project/module.json @@ -6,13 +6,13 @@ "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["3.1"] } + "specVersion": { "enum": ["3.1", "3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.1"] }, + "specVersion": { "enum": ["3.1", "3.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/kind/project/theme-library.json b/lib/validation/schema/specVersion/kind/project/theme-library.json index 44f3f2aa5..c4cba1746 100644 --- a/lib/validation/schema/specVersion/kind/project/theme-library.json +++ b/lib/validation/schema/specVersion/kind/project/theme-library.json @@ -6,13 +6,13 @@ "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["3.0", "3.1"] } + "specVersion": { "enum": ["3.0", "3.1", "3.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["3.0", "3.1"] }, + "specVersion": { "enum": ["3.0", "3.1", "3.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/specVersion.json b/lib/validation/schema/specVersion/specVersion.json index 6debcbd3e..73035e20a 100644 --- a/lib/validation/schema/specVersion/specVersion.json +++ b/lib/validation/schema/specVersion/specVersion.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion"], "properties": { - "specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["3.2", "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, "kind": { "enum": ["project", "extension", null], "$comment": "Using null to allow not defining 'kind' which defaults to project" diff --git a/lib/validation/schema/ui5.json b/lib/validation/schema/ui5.json index 61795c909..a65e85b45 100644 --- a/lib/validation/schema/ui5.json +++ b/lib/validation/schema/ui5.json @@ -10,17 +10,17 @@ "properties": { "specVersion": { "enum": [ - "3.1", "3.0", + "3.2", "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0", "1.1", "1.0", "0.1" ], - "errorMessage": "Unsupported \"specVersion\"\nYour UI5 CLI installation might be outdated.\nSupported specification versions: \"3.1\", \"3.0\", \"2.6\", \"2.5\", \"2.4\", \"2.3\", \"2.2\", \"2.1\", \"2.0\", \"1.1\", \"1.0\", \"0.1\"\nFor details, see: https://sap.github.io/ui5-tooling/pages/Configuration/#specification-versions" + "errorMessage": "Unsupported \"specVersion\"\nYour UI5 CLI installation might be outdated.\nSupported specification versions: \"3.2\", \"3.1\", \"3.0\", \"2.6\", \"2.5\", \"2.4\", \"2.3\", \"2.2\", \"2.1\", \"2.0\", \"1.1\", \"1.0\", \"0.1\"\nFor details, see: https://sap.github.io/ui5-tooling/pages/Configuration/#specification-versions" } }, "if": { "properties": { - "specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] } + "specVersion": { "enum": ["3.2", "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] } } }, "then": { diff --git a/test/lib/specifications/SpecificationVersion.js b/test/lib/specifications/SpecificationVersion.js index 64efc696f..c2015d10d 100644 --- a/test/lib/specifications/SpecificationVersion.js +++ b/test/lib/specifications/SpecificationVersion.js @@ -238,14 +238,14 @@ test("(static) getVersionsForRange", (t) => { // range: >=2.2 t.deepEqual(SpecificationVersion.getVersionsForRange(">=2.2"), [ "2.2", "2.3", "2.4", "2.5", "2.6", - "3.0", "3.1", + "3.0", "3.1", "3.2", ]); // range: > 1.0 t.deepEqual(SpecificationVersion.getVersionsForRange("> 1.0"), [ "1.1", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", - "3.0", "3.1", + "3.0", "3.1", "3.2", ]); // range: 2.2 - 2.4 diff --git a/test/lib/validation/schema/specVersion/kind/project/application.js b/test/lib/validation/schema/specVersion/kind/project/application.js index ca005d415..16497d4ce 100644 --- a/test/lib/validation/schema/specVersion/kind/project/application.js +++ b/test/lib/validation/schema/specVersion/kind/project/application.js @@ -291,223 +291,6 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach(function(specVersion) } ]); }); - - test(`Invalid builder configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "application", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - // jsdoc is not supported for type application - "jsdoc": { - "excludes": [ - "some/project/name/thirdparty/**" - ] - }, - "bundles": [ - { - "bundleDefinition": { - "name": "sap-ui-custom.js", - "defaultFileTypes": [ - ".js" - ], - "sections": [ - { - "name": true, - "mode": "raw", - "filters": [ - "ui5loader-autoconfig.js" - ], - "resolve": true, - "sort": true, - "declareModules": true - } - ] - }, - "bundleOptions": { - "optimize": true - } - }, - { - "bundleDefinition": { - "defaultFileTypes": [ - ".js", true - ], - "sections": [ - { - "filters": [ - "some/app/Component.js" - ], - "resolve": true, - "sort": true, - "declareRawModules": [] - }, - { - "mode": "provide", - "filters": "*", - "resolve": true - } - ] - }, - "bundleOptions": { - "optimize": "true", - "numberOfParts": "3", - "notAllowed": true - } - } - ], - "componentPreload": { - "path": "some/invalid/path", - "paths": "some/invalid/glob/**/pattern/Component.js", - "namespaces": "some/invalid/namespace", - }, - "libraryPreload": {} // Only supported for type library - } - }, [ - { - dataPath: "/builder", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "jsdoc" - } - }, - { - dataPath: "/builder", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "libraryPreload" - } - }, - { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "declareModules", - } - }, - { - dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", - keyword: "type", - message: "should be string", - params: { - type: "string", - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition", - keyword: "required", - message: "should have required property 'name'", - params: { - missingProperty: "name", - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", - keyword: "type", - message: "should be string", - params: { - type: "string", - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0", - keyword: "required", - message: "should have required property 'mode'", - params: { - missingProperty: "mode", - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", - keyword: "type", - message: "should be boolean", - params: { - type: "boolean", - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", - keyword: "enum", - message: "should be equal to one of the allowed values", - params: { - allowedValues: ["3.1", "3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ - "raw", - "preload", - "require", - "provided", - "bundleInfo" - ] : [ - "raw", - "preload", - "require", - "provided" - ] - } - }, - { - dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", - keyword: "type", - message: "should be array", - params: { - type: "array", - } - }, - { - dataPath: "/builder/bundles/1/bundleOptions", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "notAllowed", - } - }, - { - dataPath: "/builder/bundles/1/bundleOptions/optimize", - keyword: "type", - message: "should be boolean", - params: { - type: "boolean", - } - }, - { - dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", - keyword: "type", - message: "should be number", - params: { - type: "number", - } - }, - { - dataPath: "/builder/componentPreload", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "path", - } - }, - { - dataPath: "/builder/componentPreload/paths", - keyword: "type", - message: "should be array", - params: { - type: "array", - } - }, - { - dataPath: "/builder/componentPreload/namespaces", - keyword: "type", - message: "should be array", - params: { - type: "array", - } - } - ]); - }); }); SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersion) { @@ -1011,4 +794,438 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) }); }); +SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersion) { + test(`Invalid builder configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "application", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + // jsdoc is not supported for type application + "jsdoc": { + "excludes": [ + "some/project/name/thirdparty/**" + ] + }, + "bundles": [ + { + "bundleDefinition": { + "name": "sap-ui-custom.js", + "defaultFileTypes": [ + ".js" + ], + "sections": [ + { + "name": true, + "mode": "raw", + "filters": [ + "ui5loader-autoconfig.js" + ], + "resolve": true, + "sort": true, + "declareModules": true + } + ] + }, + "bundleOptions": { + "optimize": true + } + }, + { + "bundleDefinition": { + "defaultFileTypes": [ + ".js", true + ], + "sections": [ + { + "filters": [ + "some/app/Component.js" + ], + "resolve": true, + "sort": true, + "declareRawModules": [] + }, + { + "mode": "provide", + "filters": "*", + "resolve": true + } + ] + }, + "bundleOptions": { + "optimize": "true", + "numberOfParts": "3", + "notAllowed": true + } + } + ], + "componentPreload": { + "path": "some/invalid/path", + "paths": "some/invalid/glob/**/pattern/Component.js", + "namespaces": "some/invalid/namespace", + }, + "libraryPreload": {} // Only supported for type library + } + }, [ + { + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "jsdoc" + } + }, + { + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "libraryPreload" + } + }, + { + dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "declareModules", + } + }, + { + dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + keyword: "type", + message: "should be string", + params: { + type: "string", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition", + keyword: "required", + message: "should have required property 'name'", + params: { + missingProperty: "name", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + keyword: "required", + message: "should have required property 'mode'", + params: { + missingProperty: "mode", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + keyword: "type", + message: "should be boolean", + params: { + type: "boolean", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + keyword: "enum", + message: "should be equal to one of the allowed values", + params: { + allowedValues: ["3.1", "3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ + "raw", + "preload", + "require", + "provided", + "bundleInfo" + ] : [ + "raw", + "preload", + "require", + "provided" + ] + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions/optimize", + keyword: "type", + message: "should be boolean", + params: { + type: "boolean", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + keyword: "type", + message: "should be number", + params: { + type: "number", + } + }, + { + dataPath: "/builder/componentPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "path", + } + }, + { + dataPath: "/builder/componentPreload/paths", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + }, + { + dataPath: "/builder/componentPreload/namespaces", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + } + ]); + }); +}); + +SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) { + test(`Invalid builder configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "application", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + // jsdoc is not supported for type application + "jsdoc": { + "excludes": [ + "some/project/name/thirdparty/**" + ] + }, + "bundles": [ + { + "bundleDefinition": { + "name": "sap-ui-custom.js", + "defaultFileTypes": [ + ".js" + ], + "sections": [ + { + "name": true, + "mode": "raw", + "filters": [ + "ui5loader-autoconfig.js" + ], + "resolve": true, + "sort": true, + "declareModules": true + } + ] + }, + "bundleOptions": { + "optimize": true + } + }, + { + "bundleDefinition": { + "defaultFileTypes": [ + ".js", true + ], + "sections": [ + { + "filters": [ + "some/app/Component.js" + ], + "resolve": true, + "sort": true, + "declareRawModules": [] + }, + { + "mode": "provide", + "filters": "*", + "resolve": true + } + ] + }, + "bundleOptions": { + "optimize": "true", + "numberOfParts": "3", + "notAllowed": true + } + } + ], + "componentPreload": { + "path": "some/invalid/path", + "paths": "some/invalid/glob/**/pattern/Component.js", + "namespaces": "some/invalid/namespace", + }, + "libraryPreload": {} // Only supported for type library + } + }, [ + { + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "jsdoc" + } + }, + { + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "libraryPreload" + } + }, + { + dataPath: "/builder/bundles/0/bundleDefinition/sections/0", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "declareModules", + } + }, + { + dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", + keyword: "type", + message: "should be string", + params: { + type: "string", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition", + keyword: "required", + message: "should have required property 'name'", + params: { + missingProperty: "name", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + keyword: "required", + message: "should have required property 'mode'", + params: { + missingProperty: "mode", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", + keyword: "type", + message: "should be boolean", + params: { + type: "boolean", + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + keyword: "enum", + message: "should be equal to one of the allowed values", + params: { + allowedValues: [ + "raw", + "preload", + "require", + "provided", + "bundleInfo", + "depCache" + ] + } + }, + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions/optimize", + keyword: "type", + message: "should be boolean", + params: { + type: "boolean", + } + }, + { + dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", + keyword: "type", + message: "should be number", + params: { + type: "number", + } + }, + { + dataPath: "/builder/componentPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "path", + } + }, + { + dataPath: "/builder/componentPreload/paths", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + }, + { + dataPath: "/builder/componentPreload/namespaces", + keyword: "type", + message: "should be array", + params: { + type: "array", + } + } + ]); + }); +}); + project.defineTests(test, assertValidation, "application"); diff --git a/test/lib/validation/schema/specVersion/kind/project/library.js b/test/lib/validation/schema/specVersion/kind/project/library.js index baf248fa1..8ca82bfdf 100644 --- a/test/lib/validation/schema/specVersion/kind/project/library.js +++ b/test/lib/validation/schema/specVersion/kind/project/library.js @@ -194,6 +194,652 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach(function(specVersion) }); }); + test(`library (specVersion ${specVersion}): Invalid builder configuration`, async (t) => { + const config = { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + // cachebuster is only supported for type application + "cachebuster": { + "signatureType": "time" + } + } + }; + await assertValidation(t, config, [{ + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "cachebuster" + } + }]); + }); +}); + +SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersion) { + test(`Unsupported builder/libraryPreload configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "libraryPreload": {} + } + }, [ + { + dataPath: "/builder", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "libraryPreload", + }, + }, + ]); + }); + test(`Unsupported builder/componentPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "componentPreload": { + "excludes": [ + "some/excluded/files/**", + "some/other/excluded/files/**" + ] + } + } + }, [ + { + dataPath: "/builder/componentPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "excludes", + }, + }, + ]); + }); +}); + +SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) { + test(`library (specVersion ${specVersion}): builder/libraryPreload/excludes`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "libraryPreload": { + "excludes": [ + "some/excluded/files/**", + "some/other/excluded/files/**" + ] + } + } + }); + }); + test(`Invalid builder/libraryPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "libraryPreload": { + "excludes": "some/excluded/files/**" + } + } + }, [ + { + dataPath: "/builder/libraryPreload/excludes", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + ]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "libraryPreload": { + "excludes": [ + true, + 1, + {} + ], + "notAllowed": true + } + } + }, [ + { + dataPath: "/builder/libraryPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + }, + }, + { + dataPath: "/builder/libraryPreload/excludes/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/libraryPreload/excludes/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/libraryPreload/excludes/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + ]); + }); + + + test(`library (specVersion ${specVersion}): builder/componentPreload/excludes`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "componentPreload": { + "excludes": [ + "some/excluded/files/**", + "some/other/excluded/files/**" + ] + } + } + }); + }); + test(`Invalid builder/componentPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "componentPreload": { + "excludes": "some/excluded/files/**" + } + } + }, [ + { + dataPath: "/builder/componentPreload/excludes", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + ]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "componentPreload": { + "excludes": [ + true, + 1, + {} + ], + "notAllowed": true + } + } + }, [ + { + dataPath: "/builder/componentPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + }, + }, + { + dataPath: "/builder/componentPreload/excludes/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/componentPreload/excludes/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/componentPreload/excludes/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + ]); + }); +}); + +SpecificationVersion.getVersionsForRange(">=2.4").forEach(function(specVersion) { + // Unsupported cases for older spec-versions already tested via "allowedValues" comparison above + test(`library (specVersion ${specVersion}): builder/bundles/bundleDefinition/sections/mode: bundleInfo`, + async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "bundles": [{ + "bundleDefinition": { + "name": "my-bundle.js", + "sections": [{ + "name": "my-bundle-info", + "mode": "bundleInfo", + "filters": [] + }] + } + }] + } + }); + }); +}); + +SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) { + test(`library (specVersion ${specVersion}): builder/settings/includeDependency*`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "settings": { + "includeDependency": [ + "sap.a", + "sap.b" + ], + "includeDependencyRegExp": [ + ".ui.[a-z]+", + "^sap.[mf]$" + ], + "includeDependencyTree": [ + "sap.c", + "sap.d" + ] + } + } + }); + }); + test(`Invalid builder/settings/includeDependency* configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "settings": { + "includeDependency": "a", + "includeDependencyRegExp": "b", + "includeDependencyTree": "c" + } + } + }, [ + { + dataPath: "/builder/settings/includeDependency", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + { + dataPath: "/builder/settings/includeDependencyRegExp", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + { + dataPath: "/builder/settings/includeDependencyTree", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + ]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "settings": { + "includeDependency": [ + true, + 1, + {} + ], + "includeDependencyRegExp": [ + true, + 1, + {} + ], + "includeDependencyTree": [ + true, + 1, + {} + ], + "notAllowed": true + } + } + }, [ + { + dataPath: "/builder/settings", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + }, + }, + { + dataPath: "/builder/settings/includeDependency/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependency/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependency/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyRegExp/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyRegExp/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyRegExp/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyTree/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyTree/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/settings/includeDependencyTree/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + ]); + }); +}); + +SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) { + test(`library (specVersion ${specVersion}): builder/minification/excludes`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "minification": { + "excludes": [ + "some/excluded/files/**", + "some/other/excluded/files/**" + ] + } + } + }); + }); + test(`Invalid builder/minification/excludes configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "minification": { + "excludes": "some/excluded/files/**" + } + } + }, [ + { + dataPath: "/builder/minification/excludes", + keyword: "type", + message: "should be array", + params: { + type: "array", + }, + }, + ]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "minification": { + "excludes": [ + true, + 1, + {} + ], + "notAllowed": true + } + } + }, [ + { + dataPath: "/builder/minification", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + additionalProperty: "notAllowed", + }, + }, + { + dataPath: "/builder/minification/excludes/0", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/minification/excludes/1", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + { + dataPath: "/builder/minification/excludes/2", + keyword: "type", + message: "should be string", + params: { + type: "string", + }, + }, + ]); + }); +}); + +SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) { + test(`Invalid project name (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "illegal-🦜" + } + }, [{ + dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, + params: { + errors: [{ + dataPath: "/metadata/name", + keyword: "pattern", + message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, + params: { + pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", + }, + }] + }, + }]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "a" + } + }, [{ + dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, + params: { + errors: [{ + dataPath: "/metadata/name", + keyword: "minLength", + message: "should NOT be shorter than 3 characters", + params: { + limit: 3, + }, + }] + }, + }]); + await assertValidation(t, { + "specVersion": specVersion, + "type": "library", + "metadata": { + "name": "a".repeat(81) + } + }, [{ + dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, + params: { + errors: [{ + dataPath: "/metadata/name", + keyword: "maxLength", + message: "should NOT be longer than 80 characters", + params: { + limit: 80, + }, + }] + }, + }]); + }); +}); + +SpecificationVersion.getVersionsForRange("2.0 - 3.1").forEach(function(specVersion) { test(`library (specVersion ${specVersion}): Invalid configuration`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -538,35 +1184,10 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach(function(specVersion) } ]); }); - - test(`library (specVersion ${specVersion}): Invalid builder configuration`, async (t) => { - const config = { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - // cachebuster is only supported for type application - "cachebuster": { - "signatureType": "time" - } - } - }; - await assertValidation(t, config, [{ - dataPath: "/builder", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "cachebuster" - } - }]); - }); }); -SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersion) { - test(`Unsupported builder/libraryPreload configuration (specVersion ${specVersion})`, async (t) => { +SpecificationVersion.getVersionsForRange(">=3.2").forEach(function(specVersion) { + test(`library (specVersion ${specVersion}): Invalid configuration`, async (t) => { await assertValidation(t, { "specVersion": specVersion, "type": "library", @@ -574,613 +1195,338 @@ SpecificationVersion.getVersionsForRange("2.0 - 2.2").forEach(function(specVersi "name": "com.sap.ui5.test", "copyright": "yes" }, - "builder": { - "libraryPreload": {} - } - }, [ - { - dataPath: "/builder", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "libraryPreload", - }, - }, - ]); - }); - test(`Unsupported builder/componentPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" + "resources": { + "configuration": { + "propertiesFileSourceEncoding": "UTF8", + "paths": { + "src": {"path": "src"}, + "test": {"path": "test"}, + "webapp": "app" + } + } }, "builder": { + "resources": { + "excludes": "/resources/some/project/name/test_results/**" + }, + "bundles": [ + { + "bundleDefinition": { + "name": "sap-ui-custom.js", + "defaultFileTypes": [ + ".js" + ], + "sections": [ + { + "name": true, + "mode": "raw", + "filters": [ + "ui5loader-autoconfig.js" + ], + "resolve": true, + "sort": true, + "declareModules": true + } + ] + }, + "bundleOptions": { + "optimize": true + } + }, + { + "bundleDefinition": { + "defaultFileTypes": [ + ".js", true + ], + "sections": [ + { + "filters": [ + "some/app/Component.js" + ], + "resolve": true, + "sort": true, + "declareRawModules": [] + }, + { + "mode": "provide", + "filters": "*", + "resolve": true + } + ] + }, + "bundleOptions": { + "optimize": "true", + "numberOfParts": "3", + "notAllowed": true + } + } + ], "componentPreload": { - "excludes": [ - "some/excluded/files/**", - "some/other/excluded/files/**" - ] - } - } - }, [ - { - dataPath: "/builder/componentPreload", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "excludes", + "path": "some/invalid/path", + "paths": "some/invalid/glob/**/pattern/Component.js", + "namespaces": "some/invalid/namespace", }, - }, - ]); - }); -}); - -SpecificationVersion.getVersionsForRange(">=2.3").forEach(function(specVersion) { - test(`library (specVersion ${specVersion}): builder/libraryPreload/excludes`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "kind": "project", - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "libraryPreload": { - "excludes": [ - "some/excluded/files/**", - "some/other/excluded/files/**" - ] - } - } - }); - }); - test(`Invalid builder/libraryPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "libraryPreload": { - "excludes": "some/excluded/files/**" - } - } - }, [ - { - dataPath: "/builder/libraryPreload/excludes", - keyword: "type", - message: "should be array", - params: { - type: "array", + "jsdoc": { + "excludes": "some/project/name/thirdparty/**" }, - }, - ]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "libraryPreload": { - "excludes": [ - true, - 1, - {} - ], - "notAllowed": true + "customTasks": [ + { + "name": "custom-task-1", + "beforeTask": "replaceCopyright", + "afterTask": "replaceCopyright", + }, + { + "afterTask": "custom-task-1", + "configuration": { + "color": "blue" + } + }, + "my-task" + ] + }, + "server": { + "settings": { + "httpPort": "1337", + "httpsPort": "1443" } } }, [ { - dataPath: "/builder/libraryPreload", + dataPath: "/resources/configuration/propertiesFileSourceEncoding", + keyword: "enum", + message: "should be equal to one of the allowed values", + params: { + allowedValues: [ + "UTF-8", + "ISO-8859-1", + ], + } + }, + { + dataPath: "/resources/configuration/paths", keyword: "additionalProperties", message: "should NOT have additional properties", params: { - additionalProperty: "notAllowed", - }, + additionalProperty: "webapp", + } }, { - dataPath: "/builder/libraryPreload/excludes/0", + dataPath: "/resources/configuration/paths/src", keyword: "type", message: "should be string", params: { type: "string", - }, + } }, { - dataPath: "/builder/libraryPreload/excludes/1", + dataPath: "/resources/configuration/paths/test", keyword: "type", message: "should be string", params: { type: "string", - }, + } }, { - dataPath: "/builder/libraryPreload/excludes/2", + dataPath: "/builder/resources/excludes", keyword: "type", - message: "should be string", + message: "should be array", params: { - type: "string", - }, - }, - ]); - }); - - - test(`library (specVersion ${specVersion}): builder/componentPreload/excludes`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "kind": "project", - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "componentPreload": { - "excludes": [ - "some/excluded/files/**", - "some/other/excluded/files/**" - ] + type: "array", } - } - }); - }); - test(`Invalid builder/componentPreload/excludes configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" }, - "builder": { - "componentPreload": { - "excludes": "some/excluded/files/**" - } - } - }, [ { - dataPath: "/builder/componentPreload/excludes", + dataPath: "/builder/jsdoc/excludes", keyword: "type", message: "should be array", params: { type: "array", - }, - }, - ]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "componentPreload": { - "excludes": [ - true, - 1, - {} - ], - "notAllowed": true } - } - }, [ + }, { - dataPath: "/builder/componentPreload", + dataPath: "/builder/bundles/0/bundleDefinition/sections/0", keyword: "additionalProperties", message: "should NOT have additional properties", params: { - additionalProperty: "notAllowed", - }, + additionalProperty: "declareModules", + } }, { - dataPath: "/builder/componentPreload/excludes/0", + dataPath: "/builder/bundles/0/bundleDefinition/sections/0/name", keyword: "type", message: "should be string", params: { type: "string", - }, + } }, { - dataPath: "/builder/componentPreload/excludes/1", - keyword: "type", - message: "should be string", + dataPath: "/builder/bundles/1/bundleDefinition", + keyword: "required", + message: "should have required property 'name'", params: { - type: "string", - }, + missingProperty: "name", + } }, { - dataPath: "/builder/componentPreload/excludes/2", + dataPath: "/builder/bundles/1/bundleDefinition/defaultFileTypes/1", keyword: "type", message: "should be string", params: { type: "string", - }, - }, - ]); - }); -}); - -SpecificationVersion.getVersionsForRange(">=2.4").forEach(function(specVersion) { - // Unsupported cases for older spec-versions already tested via "allowedValues" comparison above - test(`library (specVersion ${specVersion}): builder/bundles/bundleDefinition/sections/mode: bundleInfo`, - async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "kind": "project", - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "bundles": [{ - "bundleDefinition": { - "name": "my-bundle.js", - "sections": [{ - "name": "my-bundle-info", - "mode": "bundleInfo", - "filters": [] - }] - } - }] } - }); - }); -}); - -SpecificationVersion.getVersionsForRange(">=2.5").forEach(function(specVersion) { - test(`library (specVersion ${specVersion}): builder/settings/includeDependency*`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "kind": "project", - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" }, - "builder": { - "settings": { - "includeDependency": [ - "sap.a", - "sap.b" - ], - "includeDependencyRegExp": [ - ".ui.[a-z]+", - "^sap.[mf]$" - ], - "includeDependencyTree": [ - "sap.c", - "sap.d" - ] + { + dataPath: "/builder/bundles/1/bundleDefinition/sections/0", + keyword: "required", + message: "should have required property 'mode'", + params: { + missingProperty: "mode", } - } - }); - }); - test(`Invalid builder/settings/includeDependency* configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" }, - "builder": { - "settings": { - "includeDependency": "a", - "includeDependencyRegExp": "b", - "includeDependencyTree": "c" - } - } - }, [ { - dataPath: "/builder/settings/includeDependency", + dataPath: "/builder/bundles/1/bundleDefinition/sections/0/declareRawModules", keyword: "type", - message: "should be array", + message: "should be boolean", params: { - type: "array", - }, + type: "boolean", + } }, { - dataPath: "/builder/settings/includeDependencyRegExp", - keyword: "type", - message: "should be array", + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/mode", + keyword: "enum", + message: "should be equal to one of the allowed values", params: { - type: "array", - }, + allowedValues: [ + "raw", + "preload", + "require", + "provided", + "bundleInfo", + "depCache" + ] + } }, { - dataPath: "/builder/settings/includeDependencyTree", + dataPath: "/builder/bundles/1/bundleDefinition/sections/1/filters", keyword: "type", - message: "should be array", - params: { - type: "array", - }, - }, - ]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "settings": { - "includeDependency": [ - true, - 1, - {} - ], - "includeDependencyRegExp": [ - true, - 1, - {} - ], - "includeDependencyTree": [ - true, - 1, - {} - ], - "notAllowed": true + message: "should be array", + params: { + type: "array", } - } - }, [ + }, { - dataPath: "/builder/settings", + dataPath: "/builder/bundles/1/bundleOptions", keyword: "additionalProperties", message: "should NOT have additional properties", params: { additionalProperty: "notAllowed", - }, + } }, { - dataPath: "/builder/settings/includeDependency/0", + dataPath: "/builder/bundles/1/bundleOptions/optimize", keyword: "type", - message: "should be string", + message: "should be boolean", params: { - type: "string", - }, + type: "boolean", + } }, { - dataPath: "/builder/settings/includeDependency/1", + dataPath: "/builder/bundles/1/bundleOptions/numberOfParts", keyword: "type", - message: "should be string", + message: "should be number", params: { - type: "string", - }, + type: "number", + } }, { - dataPath: "/builder/settings/includeDependency/2", - keyword: "type", - message: "should be string", + dataPath: "/builder/componentPreload", + keyword: "additionalProperties", + message: "should NOT have additional properties", params: { - type: "string", - }, + additionalProperty: "path", + } }, { - dataPath: "/builder/settings/includeDependencyRegExp/0", + dataPath: "/builder/componentPreload/paths", keyword: "type", - message: "should be string", + message: "should be array", params: { - type: "string", - }, + type: "array", + } }, { - dataPath: "/builder/settings/includeDependencyRegExp/1", + dataPath: "/builder/componentPreload/namespaces", keyword: "type", - message: "should be string", + message: "should be array", params: { - type: "string", - }, + type: "array", + } }, { - dataPath: "/builder/settings/includeDependencyRegExp/2", - keyword: "type", - message: "should be string", + dataPath: "/builder/customTasks/0", + keyword: "additionalProperties", + message: "should NOT have additional properties", params: { - type: "string", - }, + additionalProperty: "afterTask", + } }, { - dataPath: "/builder/settings/includeDependencyTree/0", - keyword: "type", - message: "should be string", + dataPath: "/builder/customTasks/0", + keyword: "additionalProperties", + message: "should NOT have additional properties", params: { - type: "string", - }, + additionalProperty: "beforeTask", + } }, { - dataPath: "/builder/settings/includeDependencyTree/1", - keyword: "type", - message: "should be string", + dataPath: "/builder/customTasks/1", + keyword: "additionalProperties", + message: "should NOT have additional properties", params: { - type: "string", - }, + additionalProperty: "afterTask", + } }, { - dataPath: "/builder/settings/includeDependencyTree/2", - keyword: "type", - message: "should be string", + dataPath: "/builder/customTasks/1", + keyword: "required", + message: "should have required property 'name'", params: { - type: "string", - }, - }, - ]); - }); -}); - -SpecificationVersion.getVersionsForRange(">=2.6").forEach(function(specVersion) { - test(`library (specVersion ${specVersion}): builder/minification/excludes`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "kind": "project", - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "minification": { - "excludes": [ - "some/excluded/files/**", - "some/other/excluded/files/**" - ] + missingProperty: "name", } - } - }); - }); - test(`Invalid builder/minification/excludes configuration (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" }, - "builder": { - "minification": { - "excludes": "some/excluded/files/**" - } - } - }, [ { - dataPath: "/builder/minification/excludes", - keyword: "type", - message: "should be array", + dataPath: "/builder/customTasks/1", + keyword: "required", + message: "should have required property 'beforeTask'", params: { - type: "array", - }, - }, - ]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "com.sap.ui5.test", - "copyright": "yes" - }, - "builder": { - "minification": { - "excludes": [ - true, - 1, - {} - ], - "notAllowed": true + missingProperty: "beforeTask", } - } - }, [ - { - dataPath: "/builder/minification", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - additionalProperty: "notAllowed", - }, }, { - dataPath: "/builder/minification/excludes/0", + dataPath: "/builder/customTasks/2", keyword: "type", - message: "should be string", + message: "should be object", params: { - type: "string", - }, + type: "object", + } }, { - dataPath: "/builder/minification/excludes/1", + dataPath: "/server/settings/httpPort", keyword: "type", - message: "should be string", + message: "should be number", params: { - type: "string", - }, + type: "number", + } }, { - dataPath: "/builder/minification/excludes/2", + dataPath: "/server/settings/httpsPort", keyword: "type", - message: "should be string", + message: "should be number", params: { - type: "string", - }, - }, + type: "number", + } + } ]); }); }); -SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion) { - test(`Invalid project name (specVersion ${specVersion})`, async (t) => { - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "illegal-🦜" - } - }, [{ - dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, - params: { - errors: [{ - dataPath: "/metadata/name", - keyword: "pattern", - message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`, - params: { - pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$", - }, - }] - }, - }]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "a" - } - }, [{ - dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, - params: { - errors: [{ - dataPath: "/metadata/name", - keyword: "minLength", - message: "should NOT be shorter than 3 characters", - params: { - limit: 3, - }, - }] - }, - }]); - await assertValidation(t, { - "specVersion": specVersion, - "type": "library", - "metadata": { - "name": "a".repeat(81) - } - }, [{ - dataPath: "/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://sap.github.io/ui5-tooling/stable/pages/Configuration/#name`, - params: { - errors: [{ - dataPath: "/metadata/name", - keyword: "maxLength", - message: "should NOT be longer than 80 characters", - params: { - limit: 80, - }, - }] - }, - }]); - }); -}); project.defineTests(test, assertValidation, "library"); diff --git a/test/lib/validation/schema/ui5.js b/test/lib/validation/schema/ui5.js index 8cc1c77d7..4ac9192c8 100644 --- a/test/lib/validation/schema/ui5.js +++ b/test/lib/validation/schema/ui5.js @@ -100,10 +100,11 @@ test("Invalid specVersion", async (t) => { dataPath: "/specVersion", keyword: "errorMessage", message: -`Unsupported "specVersion" -Your UI5 CLI installation might be outdated. -Supported specification versions: "3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0", "1.1", "1.0", "0.1" -For details, see: https://sap.github.io/ui5-tooling/pages/Configuration/#specification-versions`, +"Unsupported \"specVersion\"\n" + +"Your UI5 CLI installation might be outdated.\n" + +"Supported specification versions: \"3.2\", \"3.1\", \"3.0\", \"2.6\", " + +"\"2.5\", \"2.4\", \"2.3\", \"2.2\", \"2.1\", \"2.0\", \"1.1\", \"1.0\", \"0.1\"\n" + +"For details, see: https://sap.github.io/ui5-tooling/pages/Configuration/#specification-versions", params: { errors: [ { @@ -112,6 +113,7 @@ For details, see: https://sap.github.io/ui5-tooling/pages/Configuration/#specifi message: "should be equal to one of the allowed values", params: { allowedValues: [ + "3.2", "3.1", "3.0", "2.6",