From 89397a25cabccacbd66210469d9456895cb5a3fe Mon Sep 17 00:00:00 2001 From: binoyPeries Date: Wed, 21 Aug 2024 15:19:23 +0530 Subject: [PATCH] Make schema file path optional --- dist/index.js | 6 +++++- index.js | 2 +- schemas.js | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index a8f1e78..315d8d3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36117,6 +36117,10 @@ yup.addMethod(yup.string, "schemaFileExists", function (srcDir) { return this.test({ name: "schema-file-exists", test: (value) => { + // schema file path is optional, hence return true if it is not present + if (!value) { + return true; + } schemaFilePath = path.join(srcDir, value); try { const hasFile = fs.existsSync(schemaFilePath); @@ -38141,7 +38145,7 @@ async function main() { await validateComponentYaml(sourceRootDir); } catch (error) { console.log("component.yaml validation failed: ", error.message); - core.setFailed("component.yaml validation failed: ", error.message); + core.setFailed("component.yaml validation failed ", error.message); } } diff --git a/index.js b/index.js index 866b414..3910058 100644 --- a/index.js +++ b/index.js @@ -53,7 +53,7 @@ async function main() { await validateComponentYaml(sourceRootDir); } catch (error) { console.log("component.yaml validation failed: ", error.message); - core.setFailed("component.yaml validation failed: ", error.message); + core.setFailed("component.yaml validation failed ", error.message); } } diff --git a/schemas.js b/schemas.js index f84238d..fe8d21f 100644 --- a/schemas.js +++ b/schemas.js @@ -57,6 +57,10 @@ yup.addMethod(yup.string, "schemaFileExists", function (srcDir) { return this.test({ name: "schema-file-exists", test: (value) => { + // schema file path is optional, hence return true if it is not present + if (!value) { + return true; + } schemaFilePath = path.join(srcDir, value); try { const hasFile = fs.existsSync(schemaFilePath);