From bcf67d62b7eca1507b33b0244f80fa5bff60dce3 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Tue, 28 Jul 2020 17:39:45 +0200 Subject: [PATCH 1/2] [FEATURE] specVersion 2.2 - Allows custom task extensions to use the new `taskUtil` API. - No structural changes to the ui5.yaml schema RFC: https://github.com/SAP/ui5-tooling/pull/243 --- lib/projectPreprocessor.js | 5 +- lib/translators/ui5Framework.js | 4 +- lib/validation/schema/specVersion/2.0.json | 2 +- .../specVersion/2.0/kind/extension.json | 2 +- .../2.0/kind/extension/project-shim.json | 4 +- .../2.0/kind/extension/server-middleware.json | 4 +- .../specVersion/2.0/kind/extension/task.json | 4 +- .../schema/specVersion/2.0/kind/project.json | 2 +- .../2.0/kind/project/application.json | 14 +- .../specVersion/2.0/kind/project/library.json | 14 +- .../specVersion/2.0/kind/project/module.json | 20 +-- .../2.0/kind/project/theme-library.json | 29 +--- lib/validation/schema/ui5.json | 6 +- test/lib/projectPreprocessor.js | 16 ++ .../schema/__helper__/customConfiguration.js | 24 +-- .../validation/schema/__helper__/extension.js | 6 +- .../validation/schema/__helper__/framework.js | 2 +- .../validation/schema/__helper__/project.js | 7 +- .../schema/specVersion/2.0/kind/extension.js | 2 +- .../2.0/kind/extension/project-shim.js | 4 +- .../2.0/kind/project/application.js | 2 +- .../specVersion/2.0/kind/project/library.js | 2 +- .../specVersion/2.0/kind/project/module.js | 162 +++++++++--------- .../2.0/kind/project/theme-library.js | 2 +- test/lib/validation/schema/ui5.js | 3 +- 25 files changed, 151 insertions(+), 191 deletions(-) diff --git a/lib/projectPreprocessor.js b/lib/projectPreprocessor.js index b85870ce0..4771a5a40 100644 --- a/lib/projectPreprocessor.js +++ b/lib/projectPreprocessor.js @@ -278,7 +278,7 @@ class ProjectPreprocessor { if (project.specVersion !== "0.1" && project.specVersion !== "1.0" && project.specVersion !== "1.1" && project.specVersion !== "2.0" && - project.specVersion !== "2.1") { + project.specVersion !== "2.1" && project.specVersion !== "2.2") { throw new Error( `Unsupported specification version ${project.specVersion} defined for project ` + `${project.id}. Your UI5 CLI installation might be outdated. ` + @@ -354,7 +354,8 @@ class ProjectPreprocessor { extension.specVersion !== "1.0" && extension.specVersion !== "1.1" && extension.specVersion !== "2.0" && - extension.specVersion !== "2.1") { + extension.specVersion !== "2.1" && + extension.specVersion !== "2.2") { throw new Error( `Unsupported specification version ${extension.specVersion} defined for extension ` + `${extension.metadata.name}. Your UI5 CLI installation might be outdated. ` + diff --git a/lib/translators/ui5Framework.js b/lib/translators/ui5Framework.js index 40482e0e0..6ff91f90b 100644 --- a/lib/translators/ui5Framework.js +++ b/lib/translators/ui5Framework.js @@ -83,7 +83,7 @@ const utils = { if (!project.framework) { return; } - if (project.specVersion !== "2.0" && project.specVersion !== "2.1") { + if (project.specVersion !== "2.0" && project.specVersion !== "2.1" && project.specVersion !== "2.2") { log.warn(`Project ${project.metadata.name} defines invalid ` + `specification version ${project.specVersion} for framework.libraries configuration`); return; @@ -239,7 +239,7 @@ module.exports = { }); queue.push(...project.dependencies); - if ((project.specVersion === "2.0" || project.specVersion === "2.1") && + if ((project.specVersion === "2.0" || project.specVersion === "2.0" || project.specVersion === "2.2") && project.framework && project.framework.libraries) { const frameworkDeps = project.framework.libraries .filter((dependency) => { diff --git a/lib/validation/schema/specVersion/2.0.json b/lib/validation/schema/specVersion/2.0.json index 48e48d383..35a7eac0b 100644 --- a/lib/validation/schema/specVersion/2.0.json +++ b/lib/validation/schema/specVersion/2.0.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion"], "properties": { - "specVersion": { "enum": ["2.1", "2.0"] }, + "specVersion": { "enum": ["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/specVersion/2.0/kind/extension.json b/lib/validation/schema/specVersion/2.0/kind/extension.json index be984e619..fcff79e40 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "kind", "type", "metadata"], "properties": { - "specVersion": { "enum": ["2.1", "2.0"] }, + "specVersion": { "enum": ["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/2.0/kind/extension/project-shim.json index 57ae24120..cfafd1834 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.json @@ -6,14 +6,14 @@ "required": ["specVersion", "kind", "type", "metadata", "shims"], "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { "specVersion": { - "enum": ["2.1"] + "enum": ["2.1", "2.2"] }, "kind": { "enum": ["extension"] diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json b/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json index c1330f4ad..3f37e16be 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/server-middleware.json @@ -7,13 +7,13 @@ "required": ["specVersion", "kind", "type", "metadata", "middleware"], "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/extension/task.json b/lib/validation/schema/specVersion/2.0/kind/extension/task.json index 57e3cbe9c..8656ef15a 100644 --- a/lib/validation/schema/specVersion/2.0/kind/extension/task.json +++ b/lib/validation/schema/specVersion/2.0/kind/extension/task.json @@ -6,13 +6,13 @@ "required": ["specVersion", "kind", "type", "metadata", "task"], "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["extension"] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project.json b/lib/validation/schema/specVersion/2.0/kind/project.json index d0d6b77a0..eb193c205 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project.json +++ b/lib/validation/schema/specVersion/2.0/kind/project.json @@ -5,7 +5,7 @@ "type": "object", "required": ["specVersion", "type"], "properties": { - "specVersion": { "enum": ["2.1", "2.0"] }, + "specVersion": { "enum": ["2.2", "2.1", "2.0"] }, "kind": { "enum": ["project", null], "$comment": "Using null to allow not defining 'kind' which defaults to project" diff --git a/lib/validation/schema/specVersion/2.0/kind/project/application.json b/lib/validation/schema/specVersion/2.0/kind/project/application.json index e9f5a88a7..3ce92af51 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/application.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/application.json @@ -4,25 +4,15 @@ "type": "object", "required": ["specVersion", "type", "metadata"], - "properties": { - "specVersion": { "enum": ["2.1", "2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["application"] - } - }, - "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/library.json b/lib/validation/schema/specVersion/2.0/kind/project/library.json index cc66e4317..cd2086013 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/library.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/library.json @@ -4,25 +4,15 @@ "type": "object", "required": ["specVersion", "type", "metadata"], - "properties": { - "specVersion": { "enum": ["2.1","2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["library"] - } - }, - "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/module.json b/lib/validation/schema/specVersion/2.0/kind/project/module.json index e4978c6e7..d315140a4 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/module.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/module.json @@ -4,31 +4,15 @@ "type": "object", "required": ["specVersion", "type", "metadata"], - "properties": { - "specVersion": { "enum": ["2.1","2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["module"] - }, - "metadata": { - "$ref": "../project.json#/definitions/metadata" - }, - "resources": { - "$ref": "#/definitions/resources" - } - }, - "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json b/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json index a9a074c3c..210949d2d 100644 --- a/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json +++ b/lib/validation/schema/specVersion/2.0/kind/project/theme-library.json @@ -4,40 +4,15 @@ "type": "object", "required": ["specVersion", "type", "metadata"], - "properties": { - "specVersion": { "enum": ["2.1", "2.0"] }, - "kind": { - "enum": ["project", null] - }, - "type": { - "enum": ["theme-library"] - }, - "metadata": { - "$ref": "../project.json#/definitions/metadata" - }, - "framework": { - "$ref": "../project.json#/definitions/framework" - }, - "resources": { - "$ref": "library.json#/definitions/resources" - }, - "builder": { - "$ref": "#/definitions/builder" - }, - "server": { - "$ref": "../project.json#/definitions/server" - } - }, - "if": { "properties": { - "specVersion": { "enum": ["2.1"] } + "specVersion": { "enum": ["2.1", "2.2"] } } }, "then": { "additionalProperties": false, "properties": { - "specVersion": { "enum": ["2.1"] }, + "specVersion": { "enum": ["2.1", "2.2"] }, "kind": { "enum": ["project", null] }, diff --git a/lib/validation/schema/ui5.json b/lib/validation/schema/ui5.json index a9614c1b1..0671a590a 100644 --- a/lib/validation/schema/ui5.json +++ b/lib/validation/schema/ui5.json @@ -10,16 +10,16 @@ "properties": { "specVersion": { "enum": [ - "2.1", "2.0", + "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.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: \"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.1", "2.0"] } + "specVersion": { "enum": ["2.2", "2.1", "2.0"] } } }, "then": { diff --git a/test/lib/projectPreprocessor.js b/test/lib/projectPreprocessor.js index bfd55f0fb..a05323049 100644 --- a/test/lib/projectPreprocessor.js +++ b/test/lib/projectPreprocessor.js @@ -1718,6 +1718,22 @@ test("specVersion: Project with valid version 2.1", async (t) => { t.deepEqual(res.specVersion, "2.1", "Correct spec version"); }); +test("specVersion: Project with valid version 2.2", async (t) => { + const tree = { + id: "application.a", + path: applicationAPath, + dependencies: [], + version: "1.0.0", + specVersion: "2.2", + type: "application", + metadata: { + name: "xy" + } + }; + const res = await projectPreprocessor.processTree(tree); + t.deepEqual(res.specVersion, "2.2", "Correct spec version"); +}); + test("isBeingProcessed: Is not being processed", (t) => { const preprocessor = new projectPreprocessor._ProjectPreprocessor({}); diff --git a/test/lib/validation/schema/__helper__/customConfiguration.js b/test/lib/validation/schema/__helper__/customConfiguration.js index 6157fe6d0..cae656219 100644 --- a/test/lib/validation/schema/__helper__/customConfiguration.js +++ b/test/lib/validation/schema/__helper__/customConfiguration.js @@ -36,17 +36,19 @@ module.exports = { ]); }); - test(`${type}: Valid customConfiguration (specVersion 2.1)`, async (t) => { - await assertValidation(t, Object.assign( { - "specVersion": "2.1", - "type": type, - "metadata": { - "name": "my-" + type - }, - "customConfiguration": { - "foo": "bar" - } - }, additionalConfiguration)); + ["2.2", "2.1"].forEach((specVersion) => { + test(`${type}: Valid customConfiguration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, Object.assign( { + "specVersion": specVersion, + "type": type, + "metadata": { + "name": "my-" + type + }, + "customConfiguration": { + "foo": "bar" + } + }, additionalConfiguration)); + }); }); } }; diff --git a/test/lib/validation/schema/__helper__/extension.js b/test/lib/validation/schema/__helper__/extension.js index af552d249..0770622c3 100644 --- a/test/lib/validation/schema/__helper__/extension.js +++ b/test/lib/validation/schema/__helper__/extension.js @@ -18,7 +18,7 @@ module.exports = { customConfiguration.defineTests(test, assertValidation, type, additionalConfiguration); - ["2.0", "2.1"].forEach((specVersion) => { + ["2.2", "2.1", "2.0"].forEach((specVersion) => { test(`kind: extension / type: ${type} basic (${specVersion})`, async (t) => { await assertValidation(t, Object.assign({ "specVersion": specVersion, @@ -44,7 +44,7 @@ module.exports = { params: { "additionalProperty": "resources" }, - schemaPath: specVersion === "2.1" ? "#/then/additionalProperties" : "#/else/additionalProperties" + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties" }]); }); @@ -65,7 +65,7 @@ module.exports = { additionalProperty: "notAllowed", }, schemaPath: - specVersion === "2.1" ? "#/then/additionalProperties" : "#/else/additionalProperties" + specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties" }]); }); }); diff --git a/test/lib/validation/schema/__helper__/framework.js b/test/lib/validation/schema/__helper__/framework.js index b3531db66..742a9d307 100644 --- a/test/lib/validation/schema/__helper__/framework.js +++ b/test/lib/validation/schema/__helper__/framework.js @@ -10,7 +10,7 @@ module.exports = { * @param {string} type one of "application", "library" and "theme-library" */ defineTests: function(test, assertValidation, type) { - ["2.0", "2.1"].forEach((specVersion) => { + ["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 97c75d8a7..418e920ee 100644 --- a/test/lib/validation/schema/__helper__/project.js +++ b/test/lib/validation/schema/__helper__/project.js @@ -22,10 +22,9 @@ module.exports = { // customConfiguration tests customConfiguration.defineTests(test, assertValidation, type); - // version specific tests - ["2.0", "2.1"].forEach((specVersion) => { - // tests for all kinds and version 2.0 and 2.1 + ["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, { "specVersion": specVersion, @@ -279,7 +278,7 @@ module.exports = { params: { additionalProperty: "notAllowed", }, - schemaPath: specVersion === "2.1" ? "#/then/additionalProperties" : "#/else/additionalProperties", + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties", }]); }); }); diff --git a/test/lib/validation/schema/specVersion/2.0/kind/extension.js b/test/lib/validation/schema/specVersion/2.0/kind/extension.js index abbfc0cc0..a7cb45a12 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/extension.js @@ -33,7 +33,7 @@ test.after.always((t) => { }; t.context.ajvCoverage.verify(thresholds); }); -["2.0", "2.1"].forEach((specVersion) => { +["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/2.0/kind/extension/project-shim.js index 072b504ab..81a6ba4e7 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/extension/project-shim.js @@ -35,7 +35,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.0", "2.1"].forEach((specVersion) => { +["2.2", "2.1", "2.0"].forEach((specVersion) => { test(`kind: extension / type: project-shim (${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, @@ -80,7 +80,7 @@ test.after.always((t) => { params: { "additionalProperty": "middleware" }, - schemaPath: specVersion === "2.1" ? "#/then/additionalProperties" : "#/else/additionalProperties", + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties", }, { dataPath: "/shims", diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/application.js b/test/lib/validation/schema/specVersion/2.0/kind/project/application.js index 2e56d9652..6070023b1 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/application.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/application.js @@ -35,7 +35,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.1", "2.0"].forEach(function(specVersion) { +["2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`Valid configuration (specVersion ${specVersion})`, 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/2.0/kind/project/library.js index 189ae4920..7a1bc1de4 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/library.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/library.js @@ -35,7 +35,7 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -["2.1", "2.0"].forEach(function(specVersion) { +["2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`library (specVersion ${specVersion}): Valid configuration`, 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/2.0/kind/project/module.js index 4e4eb2fba..d4b3d8011 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/module.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/module.js @@ -35,93 +35,95 @@ test.after.always((t) => { t.context.ajvCoverage.verify(thresholds); }); -test("Valid configuration", async (t) => { - await assertValidation(t, { - "specVersion": "2.0", - "kind": "project", - "type": "module", - "metadata": { - "name": "my-module" - }, - "resources": { - "configuration": { - "paths": { - "/resources/my/library/module-xy/": "lib", - "/resources/my/library/module-xy-min/": "dist" +["2.2", "2.1", "2.0"].forEach((specVersion) => { + test(`Valid configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "kind": "project", + "type": "module", + "metadata": { + "name": "my-module" + }, + "resources": { + "configuration": { + "paths": { + "/resources/my/library/module-xy/": "lib", + "/resources/my/library/module-xy-min/": "dist" + } } } - } + }); }); -}); -test("No framework configuration", async (t) => { - await assertValidation(t, { - "specVersion": "2.0", - "type": "module", - "metadata": { - "name": "my-module" - }, - "framework": {} - }, [{ - dataPath: "", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - "additionalProperty": "framework" - }, - schemaPath: "#/else/additionalProperties" - }]); -}); + test(`No framework configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "module", + "metadata": { + "name": "my-module" + }, + "framework": {} + }, [{ + dataPath: "", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + "additionalProperty": "framework" + }, + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties", + }]); + }); -test("No propertiesFileSourceEncoding configuration", async (t) => { - await assertValidation(t, { - "specVersion": "2.0", - "type": "module", - "metadata": { - "name": "my-module" - }, - "resources": { - "configuration": { - "propertiesFileSourceEncoding": "UTF-8" + test(`No propertiesFileSourceEncoding configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "module", + "metadata": { + "name": "my-module" + }, + "resources": { + "configuration": { + "propertiesFileSourceEncoding": "UTF-8" + } } - } - }, [{ - dataPath: "/resources/configuration", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - "additionalProperty": "propertiesFileSourceEncoding" - }, - schemaPath: "#/definitions/resources/properties/configuration/additionalProperties" - }]); -}); + }, [{ + dataPath: "/resources/configuration", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + "additionalProperty": "propertiesFileSourceEncoding" + }, + schemaPath: "#/definitions/resources/properties/configuration/additionalProperties" + }]); + }); -test("No builder, server configuration", async (t) => { - await assertValidation(t, { - "specVersion": "2.0", - "type": "module", - "metadata": { - "name": "my-module" - }, - "builder": {}, - "server": {} - }, [{ - dataPath: "", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - "additionalProperty": "builder" - }, - schemaPath: "#/else/additionalProperties" - }, { - dataPath: "", - keyword: "additionalProperties", - message: "should NOT have additional properties", - params: { - "additionalProperty": "server" - }, - schemaPath: "#/else/additionalProperties" - }]); + test(`No builder, server configuration (specVersion ${specVersion})`, async (t) => { + await assertValidation(t, { + "specVersion": specVersion, + "type": "module", + "metadata": { + "name": "my-module" + }, + "builder": {}, + "server": {} + }, [{ + dataPath: "", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + "additionalProperty": "builder" + }, + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties", + }, { + dataPath: "", + keyword: "additionalProperties", + message: "should NOT have additional properties", + params: { + "additionalProperty": "server" + }, + schemaPath: specVersion !== "2.0" ? "#/then/additionalProperties" : "#/else/additionalProperties", + }]); + }); }); project.defineTests(test, assertValidation, "module"); diff --git a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js b/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js index 77e02daaa..197792b82 100644 --- a/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js +++ b/test/lib/validation/schema/specVersion/2.0/kind/project/theme-library.js @@ -36,7 +36,7 @@ test.after.always((t) => { }); -["2.1", "2.0"].forEach(function(specVersion) { +["2.2", "2.1", "2.0"].forEach(function(specVersion) { test(`Valid configuration (specVersion ${specVersion})`, async (t) => { await assertValidation(t, { "specVersion": specVersion, diff --git a/test/lib/validation/schema/ui5.js b/test/lib/validation/schema/ui5.js index 87ead2b64..8ea7abfca 100644 --- a/test/lib/validation/schema/ui5.js +++ b/test/lib/validation/schema/ui5.js @@ -96,7 +96,7 @@ test("Invalid specVersion", async (t) => { message: `Unsupported "specVersion" Your UI5 CLI installation might be outdated. -Supported specification versions: "2.1", "2.0", "1.1", "1.0", "0.1" +Supported specification versions: "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: [ @@ -106,6 +106,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: [ + "2.2", "2.1", "2.0", "1.1", From 716b1ec239f0a8c8191ba8f71a75f628d0ab8d7e Mon Sep 17 00:00:00 2001 From: Merlin Beutlberger Date: Wed, 5 Aug 2020 16:16:31 +0200 Subject: [PATCH 2/2] Update lib/translators/ui5Framework.js --- lib/translators/ui5Framework.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/translators/ui5Framework.js b/lib/translators/ui5Framework.js index 6ff91f90b..7596c4fa6 100644 --- a/lib/translators/ui5Framework.js +++ b/lib/translators/ui5Framework.js @@ -239,7 +239,7 @@ module.exports = { }); queue.push(...project.dependencies); - if ((project.specVersion === "2.0" || project.specVersion === "2.0" || project.specVersion === "2.2") && + if ((project.specVersion === "2.0" || project.specVersion === "2.1" || project.specVersion === "2.2") && project.framework && project.framework.libraries) { const frameworkDeps = project.framework.libraries .filter((dependency) => {