diff --git a/lib/ui5Framework/AbstractResolver.js b/lib/ui5Framework/AbstractResolver.js index c32c26189..7e25f6047 100644 --- a/lib/ui5Framework/AbstractResolver.js +++ b/lib/ui5Framework/AbstractResolver.js @@ -8,7 +8,7 @@ import semver from "semver"; // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string // // This needs to be aligned with the ui5.yaml JSON schema: -// lib/validation/schema/specVersion/2.0/kind/project.json#/definitions/framework/properties/version/pattern +// lib/validation/schema/specVersion/kind/project.json#/definitions/framework/properties/version/pattern // // eslint-disable-next-line max-len const SEMVER_VERSION_REGEXP = /^(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-]+)*))?$/; diff --git a/lib/validation/schema/specVersion/2.0/kind/extension.json b/lib/validation/schema/specVersion/kind/extension.json similarity index 89% rename from lib/validation/schema/specVersion/2.0/kind/extension.json rename to lib/validation/schema/specVersion/kind/extension.json index a6f47474a..c5c469100 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension.json +++ b/lib/validation/schema/specVersion/kind/extension.json @@ -1,11 +1,11 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension.json", + "$id": "http://ui5.sap/schema/specVersion/kind/extension.json", "type": "object", "required": ["specVersion", "kind", "type", "metadata"], "properties": { - "specVersion": { "enum": ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["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/2.0/kind/extension/project-shim.json b/lib/validation/schema/specVersion/kind/extension/project-shim.json similarity index 92% rename from lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json rename to lib/validation/schema/specVersion/kind/extension/project-shim.json index 8aa4c6b18..4f3d9226c 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json +++ b/lib/validation/schema/specVersion/kind/extension/project-shim.json @@ -1,19 +1,19 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/project-shim.json", + "$id": "http://ui5.sap/schema/specVersion/kind/extension/project-shim.json", "type": "object", "required": ["specVersion", "kind", "type", "metadata", "shims"], "if": { "properties": { - "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] } + "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] } } }, "then": { "additionalProperties": false, "properties": { "specVersion": { - "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] + "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] }, "kind": { "enum": ["extension"] diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json b/lib/validation/schema/specVersion/kind/extension/server-middleware.json similarity index 91% rename from lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json rename to lib/validation/schema/specVersion/kind/extension/server-middleware.json index 5385bdd9f..151c0c222 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json +++ b/lib/validation/schema/specVersion/kind/extension/server-middleware.json @@ -1,19 +1,19 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/server-middleware.json", + "$id": "http://ui5.sap/schema/specVersion/kind/extension/server-middleware.json", "type": "object", "required": ["specVersion", "kind", "type", "metadata", "middleware"], "if": { "properties": { - "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] } + "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] }, + "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/task.json b/lib/validation/schema/specVersion/kind/extension/task.json similarity index 91% rename from lib/validation/schema/specVersion/2.0/kind/extension/task.json rename to lib/validation/schema/specVersion/kind/extension/task.json index f75d2723d..ab5413c78 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/task.json +++ b/lib/validation/schema/specVersion/kind/extension/task.json @@ -1,18 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/task.json", + "$id": "http://ui5.sap/schema/specVersion/kind/extension/task.json", "type": "object", "required": ["specVersion", "kind", "type", "metadata", "task"], "if": { "properties": { - "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] } + "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] }, + "specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "3.0"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project.json b/lib/validation/schema/specVersion/kind/project.json similarity index 75% rename from lib/validation/schema/specVersion/2.0/kind/project.json rename to lib/validation/schema/specVersion/kind/project.json index 5936a8e83..3d6a1a49b 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project.json +++ b/lib/validation/schema/specVersion/kind/project.json @@ -1,11 +1,11 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/project.json", + "$id": "http://ui5.sap/schema/specVersion/kind/project.json", "type": "object", "required": ["specVersion", "type"], "properties": { - "specVersion": { "enum": ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["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" @@ -119,62 +119,7 @@ "additionalProperties": false, "properties": { "bundleDefinition": { - "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"] - }, - "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 - } - } - } - } - } + "$ref": "#/definitions/builder-bundles-bundleDefinition" }, "bundleOptions": { "$ref": "#/definitions/builder-bundles-bundleOptions" @@ -190,65 +135,142 @@ "additionalProperties": false, "properties": { "bundleDefinition": { + "$ref": "#/definitions/builder-bundles-bundleDefinition-2.4" + }, + "bundleOptions": { + "$ref": "#/definitions/builder-bundles-bundleOptions" + } + } + } + }, + "builder-bundles-3.0": { + "type": "array", + "additionalProperties": false, + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "bundleDefinition": { + "$ref": "#/definitions/builder-bundles-bundleDefinition-2.4" + }, + "bundleOptions": { + "$ref": "#/definitions/builder-bundles-bundleOptions-3.0" + } + } + } + }, + "builder-bundles-bundleDefinition": { + "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": ["name"], + "required": ["mode", "filters"], "properties": { "name": { "type": "string" }, - "defaultFileTypes": { + "mode": { + "enum": ["raw", "preload", "require", "provided"] + }, + "filters": { "type": "array", "items": { "type": "string" } }, - "sections": { + "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-bundleDefinition-2.4": { + "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"] + }, + "filters": { "type": "array", "items": { - "type": "object", - "additionalProperties": false, - "required": ["mode", "filters"], - "properties": { - "name": { - "type": "string" - }, - "mode": { - "enum": ["raw", "preload", "require", "provided", "bundleInfo"] - }, - "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 - } - } + "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 } } - }, - "bundleOptions": { - "$ref": "#/definitions/builder-bundles-bundleOptions" } } } @@ -279,6 +301,36 @@ } } }, + "builder-bundles-bundleOptions-3.0": { + "type": "object", + "additionalProperties": false, + "properties": { + "optimize": { + "type": "boolean", + "default": true + }, + "decorateBootstrapModule": { + "type": "boolean", + "default": true + }, + "addTryCatchRestartWrapper": { + "type": "boolean", + "default": false + }, + "usePredefineCalls": { + "type": "boolean", + "default": false + }, + "numberOfParts": { + "type": "number", + "default": 1 + }, + "sourceMap": { + "type": "boolean", + "default": true + } + } + }, "builder-componentPreload": { "type": "object", "additionalProperties": false, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/application.json b/lib/validation/schema/specVersion/kind/project/application.json similarity index 70% rename from lib/validation/schema/specVersion/2.0/kind/project/application.json rename to lib/validation/schema/specVersion/kind/project/application.json index 838836491..fd0b063c2 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/application.json +++ b/lib/validation/schema/specVersion/kind/project/application.json @@ -1,18 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/project/application.json", + "$id": "http://ui5.sap/schema/specVersion/kind/project/application.json", "type": "object", "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["2.6"] } + "specVersion": { "enum": ["3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.6"] }, + "specVersion": { "enum": ["3.0"] }, "kind": { "enum": ["project", null] }, @@ -29,7 +29,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.6" + "$ref": "#/definitions/builder-specVersion-3.0" }, "server": { "$ref": "../project.json#/definitions/server" @@ -41,15 +41,16 @@ } }, "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] }, @@ -66,7 +67,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.5" + "$ref": "#/definitions/builder-specVersion-2.6" }, "server": { "$ref": "../project.json#/definitions/server" @@ -80,13 +81,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] }, @@ -103,7 +104,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.4" + "$ref": "#/definitions/builder-specVersion-2.5" }, "server": { "$ref": "../project.json#/definitions/server" @@ -117,13 +118,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] }, @@ -140,7 +141,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.3" + "$ref": "#/definitions/builder-specVersion-2.4" }, "server": { "$ref": "../project.json#/definitions/server" @@ -154,13 +155,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] }, @@ -177,7 +178,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder" + "$ref": "#/definitions/builder-specVersion-2.3" }, "server": { "$ref": "../project.json#/definitions/server" @@ -189,29 +190,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" + } } } } @@ -390,6 +429,39 @@ "$ref": "../project.json#/definitions/builder-settings" } } + }, + "builder-specVersion-3.0": { + "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.0" + }, + "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/2.0/kind/project/library.json b/lib/validation/schema/specVersion/kind/project/library.json similarity index 71% rename from lib/validation/schema/specVersion/2.0/kind/project/library.json rename to lib/validation/schema/specVersion/kind/project/library.json index c38e0a3ab..86f1efe0a 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/library.json +++ b/lib/validation/schema/specVersion/kind/project/library.json @@ -1,18 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/project/library.json", + "$id": "http://ui5.sap/schema/specVersion/kind/project/library.json", "type": "object", "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["2.6"] } + "specVersion": { "enum": ["3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.6"] }, + "specVersion": { "enum": ["3.0"] }, "kind": { "enum": ["project", null] }, @@ -29,7 +29,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.6" + "$ref": "#/definitions/builder-specVersion-3.0" }, "server": { "$ref": "../project.json#/definitions/server" @@ -43,13 +43,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] }, @@ -66,7 +66,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.5" + "$ref": "#/definitions/builder-specVersion-2.6" }, "server": { "$ref": "../project.json#/definitions/server" @@ -80,13 +80,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] }, @@ -103,7 +103,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.4" + "$ref": "#/definitions/builder-specVersion-2.5" }, "server": { "$ref": "../project.json#/definitions/server" @@ -117,13 +117,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] }, @@ -140,7 +140,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder-specVersion-2.3" + "$ref": "#/definitions/builder-specVersion-2.4" }, "server": { "$ref": "../project.json#/definitions/server" @@ -154,13 +154,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] }, @@ -177,7 +177,7 @@ "$ref": "#/definitions/resources" }, "builder": { - "$ref": "#/definitions/builder" + "$ref": "#/definitions/builder-specVersion-2.3" }, "server": { "$ref": "../project.json#/definitions/server" @@ -189,29 +189,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" + } } } } @@ -384,6 +422,36 @@ "$ref": "../project.json#/definitions/builder-settings" } } + }, + "builder-specVersion-3.0": { + "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.0" + }, + "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/2.0/kind/project/module.json b/lib/validation/schema/specVersion/kind/project/module.json similarity index 92% rename from lib/validation/schema/specVersion/2.0/kind/project/module.json rename to lib/validation/schema/specVersion/kind/project/module.json index e1b55526f..8bd717ff5 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/module.json +++ b/lib/validation/schema/specVersion/kind/project/module.json @@ -1,18 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/project/module.json", + "$id": "http://ui5.sap/schema/specVersion/kind/project/module.json", "type": "object", "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["2.5", "2.6"] } + "specVersion": { "enum": ["2.5", "2.6", "3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.5", "2.6"] }, + "specVersion": { "enum": ["2.5", "2.6", "3.0"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json b/lib/validation/schema/specVersion/kind/project/theme-library.json similarity index 94% rename from lib/validation/schema/specVersion/2.0/kind/project/theme-library.json rename to lib/validation/schema/specVersion/kind/project/theme-library.json index ed5f32f89..fc292179a 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json +++ b/lib/validation/schema/specVersion/kind/project/theme-library.json @@ -1,18 +1,18 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://ui5.sap/schema/specVersion/2.0/kind/project/theme-library.json", + "$id": "http://ui5.sap/schema/specVersion/kind/project/theme-library.json", "type": "object", "required": ["specVersion", "type", "metadata"], "if": { "properties": { - "specVersion": { "enum": ["2.5", "2.6"] } + "specVersion": { "enum": ["2.5", "2.6", "3.0"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.5", "2.6"] }, + "specVersion": { "enum": ["2.5", "2.6", "3.0"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/2.0.json b/lib/validation/schema/specVersion/specVersion.json similarity index 80% rename from lib/validation/schema/specVersion/2.0.json rename to lib/validation/schema/specVersion/specVersion.json index c9b9b127f..16458d467 100644 --- a/lib/validation/schema/specVersion/2.0.json +++ b/lib/validation/schema/specVersion/specVersion.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion"], "properties": { - "specVersion": { "enum": ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] }, + "specVersion": { "enum": ["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" @@ -20,7 +20,7 @@ } }, "then": { - "$ref": "2.0/kind/project.json" + "$ref": "kind/project.json" }, "else": { "if": { @@ -31,7 +31,7 @@ } }, "then": { - "$ref": "2.0/kind/extension.json" + "$ref": "kind/extension.json" } } } diff --git a/lib/validation/schema/ui5.json b/lib/validation/schema/ui5.json index 68ca45308..6d6d1f08a 100644 --- a/lib/validation/schema/ui5.json +++ b/lib/validation/schema/ui5.json @@ -10,20 +10,21 @@ "properties": { "specVersion": { "enum": [ + "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: \"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.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": ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] } + "specVersion": { "enum": ["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] } } }, "then": { - "$ref": "specVersion/2.0.json" + "$ref": "specVersion/specVersion.json" }, "else": { "if": { diff --git a/test/lib/ui5framework/AbstractResolver.js b/test/lib/ui5framework/AbstractResolver.js index 42c60e0e7..318262229 100644 --- a/test/lib/ui5framework/AbstractResolver.js +++ b/test/lib/ui5framework/AbstractResolver.js @@ -607,7 +607,7 @@ test.serial( test.serial("AbstractResolver: SEMVER_VERSION_REGEXP should be aligned with JSON schema", async (t) => { const projectSchema = JSON.parse( await readFile(fileURLToPath( - new URL("../../../lib/validation/schema/specVersion/2.0/kind/project.json", import.meta.url) + new URL("../../../lib/validation/schema/specVersion/kind/project.json", import.meta.url) ), {encoding: "utf-8"}) ); const schemaPattern = projectSchema.definitions.framework.properties.version.pattern; diff --git a/test/lib/validation/schema/__helper__/builder-bundleOptions.js b/test/lib/validation/schema/__helper__/builder-bundleOptions.js new file mode 100644 index 000000000..1ba0be8da --- /dev/null +++ b/test/lib/validation/schema/__helper__/builder-bundleOptions.js @@ -0,0 +1,146 @@ +/** + * Common test functionality for builder/bundles/bundleOptions section in config + */ +export default { + /** + * Executes the tests for different kind of projects, e.g. "application", "library" + * + * @param {Function} test ava test + * @param {Function} assertValidation assertion function + * @param {string} type one of "application" and "library" + */ + defineTests: function(test, assertValidation, type) { + // Version specific tests + ["3.0"].forEach(function(specVersion) { + test(`${type} (specVersion ${specVersion}): builder/bundles/bundleOptions`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": type, + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "bundles": [{ + "bundleOptions": { + "optimize": false, + "decorateBootstrapModule": false, + "addTryCatchRestartWrapper": true, + "usePredefineCalls": true, + "numberOfParts": 8, + "sourceMap": false + } + }] + } + }); + }); + + test(`${type} (specVersion ${specVersion}): builder/bundles/bundleOptions properties removal`, + async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": type, + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "bundles": [{ + "bundleOptions": { + "debugMode": true + } + }] + } + }, [ + { + keyword: "additionalProperties", + dataPath: "/builder/bundles/0/bundleOptions", + params: { + additionalProperty: "debugMode", + }, + message: "should NOT have additional properties", + }, + ]); + }); + + test(`${type} invalid (specVersion ${specVersion}): builder/bundles/bundleOptions config`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": type, + "metadata": { + "name": "com.sap.ui5.test", + "copyright": "yes" + }, + "builder": { + "bundles": [{ + "bundleOptions": { + "optimize": "invalid value", + "decorateBootstrapModule": {"invalid": "value"}, + "addTryCatchRestartWrapper": ["invalid value"], + "usePredefineCalls": 12, + "numberOfParts": true, + "sourceMap": 55 + } + }] + } + }, [ + { + keyword: "type", + dataPath: "/builder/bundles/0/bundleOptions/optimize", + params: { + type: "boolean", + }, + message: "should be boolean" + }, + { + keyword: "type", + dataPath: + "/builder/bundles/0/bundleOptions/decorateBootstrapModule", + params: { + type: "boolean", + }, + message: "should be boolean" + }, + { + keyword: "type", + dataPath: + "/builder/bundles/0/bundleOptions/addTryCatchRestartWrapper", + params: { + type: "boolean", + }, + message: "should be boolean" + }, + { + keyword: "type", + dataPath: + "/builder/bundles/0/bundleOptions/usePredefineCalls", + params: { + type: "boolean", + }, + message: "should be boolean" + }, + { + keyword: "type", + dataPath: + "/builder/bundles/0/bundleOptions/numberOfParts", + params: { + type: "number", + }, + message: "should be number" + }, + { + keyword: "type", + dataPath: "/builder/bundles/0/bundleOptions/sourceMap", + params: { + type: "boolean", + }, + message: "should be boolean" + } + ]); + }); + }); + } +}; diff --git a/test/lib/validation/schema/__helper__/framework.js b/test/lib/validation/schema/__helper__/framework.js index 1e09ea3a5..d8d5ffd22 100644 --- a/test/lib/validation/schema/__helper__/framework.js +++ b/test/lib/validation/schema/__helper__/framework.js @@ -10,7 +10,7 @@ export default { * @param {string} type one of "application", "library" and "theme-library" */ defineTests: function(test, assertValidation, type) { - ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { + ["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { test(`${type} (specVersion ${specVersion}): framework configuration: OpenUI5`, async (t) => { const config = { "specVersion": specVersion, diff --git a/test/lib/validation/schema/__helper__/project.js b/test/lib/validation/schema/__helper__/project.js index a423859d9..777aeba51 100644 --- a/test/lib/validation/schema/__helper__/project.js +++ b/test/lib/validation/schema/__helper__/project.js @@ -1,5 +1,6 @@ import framework from "./framework.js"; import customConfiguration from "./customConfiguration.js"; +import bundleOptions from "./builder-bundleOptions.js"; /** * Common test functionality to be able to run the same tests for different types of kind "project" @@ -22,8 +23,13 @@ export default { // customConfiguration tests customConfiguration.defineTests(test, assertValidation, type); + // builder.bundleOptions tests + if (["application", "library"].includes(type)) { + bundleOptions.defineTests(test, assertValidation, type); + } + // version specific tests - ["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { + ["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { // tests for all kinds and version 2.0 and above test(`${type} (specVersion ${specVersion}): No metadata`, async (t) => { await assertValidation(t, { diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension.js b/test/lib/validation/schema/specVersion/kind/extension.js similarity index 89% rename from test/lib/validation/schema/specVersion/2.0/kind/extension.js rename to test/lib/validation/schema/specVersion/kind/extension.js index ddebe686a..33a3465c9 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension.js +++ b/test/lib/validation/schema/specVersion/kind/extension.js @@ -1,9 +1,9 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import AjvCoverage from "../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../lib/validation/ValidationError.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -24,7 +24,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/extension.json"] + includes: ["schema/specVersion/kind/extension.json"] }); }); @@ -38,7 +38,7 @@ test.after.always((t) => { }; t.context.ajvCoverage.verify(thresholds); }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { test(`Type project-shim (${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js b/test/lib/validation/schema/specVersion/kind/extension/project-shim.js similarity index 86% rename from test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js rename to test/lib/validation/schema/specVersion/kind/extension/project-shim.js index 1178da31e..8bfef6252 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js +++ b/test/lib/validation/schema/specVersion/kind/extension/project-shim.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import extension from "../../../../__helper__/extension.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import extension from "../../../__helper__/extension.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -25,7 +25,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/extension/project-shim.json"] + includes: ["schema/specVersion/kind/extension/project-shim.json"] }); }); @@ -40,7 +40,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { test(`kind: extension / type: project-shim (${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -52,7 +52,7 @@ test.after.always((t) => { "shims": { "configurations": { "invalid": { - "specVersion": "3.0", + "specVersion": "4.0", "type": "does-not-exist", "metadata": { "name": "my-application" @@ -134,7 +134,7 @@ const additionalConfiguration = { } }, "my-other-dependency": { - "specVersion": "3.0", + "specVersion": "4.0", "type": "does-not-exist", "metadata": { "name": "my-application" diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.js b/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js similarity index 75% rename from test/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.js rename to test/lib/validation/schema/specVersion/kind/extension/server-middleware.js index 5375e1f75..2d3411420 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.js +++ b/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import extension from "../../../../__helper__/extension.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import extension from "../../../__helper__/extension.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -25,7 +25,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/extension/server-middleware.json"] + includes: ["schema/specVersion/kind/extension/server-middleware.json"] }); }); diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension/task.js b/test/lib/validation/schema/specVersion/kind/extension/task.js similarity index 75% rename from test/lib/validation/schema/specVersion/2.0/kind/extension/task.js rename to test/lib/validation/schema/specVersion/kind/extension/task.js index 81f76bf6c..5dfcfd71e 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension/task.js +++ b/test/lib/validation/schema/specVersion/kind/extension/task.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import extension from "../../../../__helper__/extension.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import extension from "../../../__helper__/extension.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -25,7 +25,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/extension/task.json"] + includes: ["schema/specVersion/kind/extension/task.json"] }); }); diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project.js b/test/lib/validation/schema/specVersion/kind/project.js similarity index 92% rename from test/lib/validation/schema/specVersion/2.0/kind/project.js rename to test/lib/validation/schema/specVersion/kind/project.js index c35bef762..72bda51c6 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project.js +++ b/test/lib/validation/schema/specVersion/kind/project.js @@ -1,9 +1,9 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import AjvCoverage from "../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../lib/validation/ValidationError.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -24,7 +24,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/project.json"] + includes: ["schema/specVersion/kind/project.json"] }); }); diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/application.js b/test/lib/validation/schema/specVersion/kind/project/application.js similarity index 96% rename from test/lib/validation/schema/specVersion/2.0/kind/project/application.js rename to test/lib/validation/schema/specVersion/kind/project/application.js index c355bcfee..09c89baf3 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/application.js +++ b/test/lib/validation/schema/specVersion/kind/project/application.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import project from "../../../../__helper__/project.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import project from "../../../__helper__/project.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -30,7 +30,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/project/application.json"] + includes: ["schema/specVersion/kind/project/application.json"] }); }); @@ -45,7 +45,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`Valid configuration (specVersion ${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -435,7 +435,7 @@ test.after.always((t) => { keyword: "enum", message: "should be equal to one of the allowed values", params: { - allowedValues: ["2.6", "2.5", "2.4"].includes(specVersion) ? [ + allowedValues: ["3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ "raw", "preload", "require", @@ -539,7 +539,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5", "2.4", "2.3"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4", "2.3"].forEach(function(specVersion) { test(`application (specVersion ${specVersion}): builder/componentPreload/excludes`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -636,7 +636,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5", "2.4"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4"].forEach(function(specVersion) { // Unsupported cases for older spec-versions already tested via "allowedValues" comparison above test(`application (specVersion ${specVersion}): builder/bundles/bundleDefinition/sections/mode: bundleInfo`, async (t) => { @@ -664,7 +664,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5"].forEach(function(specVersion) { +["3.0", "2.6", "2.5"].forEach(function(specVersion) { test(`application (specVersion ${specVersion}): builder/settings/includeDependency*`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -845,7 +845,7 @@ test.after.always((t) => { }); }); -["2.6"].forEach(function(specVersion) { +["3.0", "2.6"].forEach(function(specVersion) { test(`application (specVersion ${specVersion}): builder/minification/excludes`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/library.js b/test/lib/validation/schema/specVersion/kind/project/library.js similarity index 96% rename from test/lib/validation/schema/specVersion/2.0/kind/project/library.js rename to test/lib/validation/schema/specVersion/kind/project/library.js index 5ee5c9db8..ed372082e 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/library.js +++ b/test/lib/validation/schema/specVersion/kind/project/library.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import project from "../../../../__helper__/project.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import project from "../../../__helper__/project.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -30,7 +30,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/project/library.json"] + includes: ["schema/specVersion/kind/project/library.json"] }); }); @@ -45,7 +45,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`library (specVersion ${specVersion}): Valid configuration`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -401,7 +401,7 @@ test.after.always((t) => { keyword: "enum", message: "should be equal to one of the allowed values", params: { - allowedValues: ["2.6", "2.5", "2.4"].includes(specVersion) ? [ + allowedValues: ["3.0", "2.6", "2.5", "2.4"].includes(specVersion) ? [ "raw", "preload", "require", @@ -616,7 +616,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5", "2.4", "2.3"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4", "2.3"].forEach(function(specVersion) { test(`library (specVersion ${specVersion}): builder/libraryPreload/excludes`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -809,7 +809,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5", "2.4"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "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) => { @@ -837,7 +837,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5"].forEach(function(specVersion) { +["3.0", "2.6", "2.5"].forEach(function(specVersion) { test(`library (specVersion ${specVersion}): builder/settings/includeDependency*`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -1018,7 +1018,7 @@ test.after.always((t) => { }); }); -["2.6"].forEach(function(specVersion) { +["3.0", "2.6"].forEach(function(specVersion) { test(`library (specVersion ${specVersion}): builder/minification/excludes`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/module.js b/test/lib/validation/schema/specVersion/kind/project/module.js similarity index 93% rename from test/lib/validation/schema/specVersion/2.0/kind/project/module.js rename to test/lib/validation/schema/specVersion/kind/project/module.js index d1d886d67..3177cc927 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/module.js +++ b/test/lib/validation/schema/specVersion/kind/project/module.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import project from "../../../../__helper__/project.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import project from "../../../__helper__/project.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -25,7 +25,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/project/module.json"] + includes: ["schema/specVersion/kind/project/module.json"] }); }); @@ -40,7 +40,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach((specVersion) => { test(`Valid configuration (specVersion ${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -139,7 +139,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5"].forEach(function(specVersion) { +["3.0", "2.6", "2.5"].forEach(function(specVersion) { test(`Server configuration (specVersion ${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js b/test/lib/validation/schema/specVersion/kind/project/theme-library.js similarity index 93% rename from test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js rename to test/lib/validation/schema/specVersion/kind/project/theme-library.js index e54ef1f14..dafcf8f92 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js +++ b/test/lib/validation/schema/specVersion/kind/project/theme-library.js @@ -1,10 +1,10 @@ import test from "ava"; import Ajv from "ajv"; import ajvErrors from "ajv-errors"; -import AjvCoverage from "../../../../../../../utils/AjvCoverage.js"; -import {_Validator as Validator} from "../../../../../../../../lib/validation/validator.js"; -import ValidationError from "../../../../../../../../lib/validation/ValidationError.js"; -import project from "../../../../__helper__/project.js"; +import AjvCoverage from "../../../../../../utils/AjvCoverage.js"; +import {_Validator as Validator} from "../../../../../../../lib/validation/validator.js"; +import ValidationError from "../../../../../../../lib/validation/ValidationError.js"; +import project from "../../../__helper__/project.js"; async function assertValidation(t, config, expectedErrors = undefined) { const validation = t.context.validator.validate({config, project: {id: "my-project"}}); @@ -30,7 +30,7 @@ async function assertValidation(t, config, expectedErrors = undefined) { test.before((t) => { t.context.validator = new Validator({Ajv, ajvErrors}); t.context.ajvCoverage = new AjvCoverage(t.context.validator.ajv, { - includes: ["schema/specVersion/2.0/kind/project/theme-library.json"] + includes: ["schema/specVersion/kind/project/theme-library.json"] }); }); @@ -46,7 +46,7 @@ test.after.always((t) => { }); -["2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { +["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`Valid configuration (specVersion ${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -167,7 +167,7 @@ test.after.always((t) => { }); }); -["2.6", "2.5"].forEach(function(specVersion) { +["3.0", "2.6", "2.5"].forEach(function(specVersion) { test(`theme-library (specVersion ${specVersion}): builder/settings/includeDependency*`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/ui5.js b/test/lib/validation/schema/ui5.js index ee5a560f8..cff33c79e 100644 --- a/test/lib/validation/schema/ui5.js +++ b/test/lib/validation/schema/ui5.js @@ -102,7 +102,7 @@ test("Invalid specVersion", async (t) => { message: `Unsupported "specVersion" Your UI5 CLI installation might be outdated. -Supported specification versions: "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0", "1.1", "1.0", "0.1" +Supported specification versions: "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`, params: { errors: [ @@ -112,6 +112,7 @@ For details see: https://sap.github.io/ui5-tooling/pages/Configuration/#specific message: "should be equal to one of the allowed values", params: { allowedValues: [ + "3.0", "2.6", "2.5", "2.4",