Skip to content

Commit

Permalink
Make schema file path optional
Browse files Browse the repository at this point in the history
  • Loading branch information
binoyPeries committed Aug 21, 2024
1 parent 87bde1e commit 89397a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 4 additions & 0 deletions schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 89397a2

Please sign in to comment.