Skip to content

Commit

Permalink
fix: schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 7, 2023
2 parents 86681d1 + 055f093 commit 8ebcbc4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions precompile-schemas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ const postprocess = async (code) => {
if (/absolutePathRegExp/.test(code))
code = `const absolutePathRegExp = /^(?:[A-Za-z]:[\\\\/]|\\\\\\\\|\\/)/;${code}`;

// remove unneccessary error code:
code = code.replace(/\{instancePath[^{}]+,keyword:[^{}]+,/g, "{");
// remove unnecessary error code:
code = code
.replace(/\{instancePath[^{}]+,keyword:[^{}]+,/g, "{")
// remove extra "$id" property
.replace(/"\$id":".+?"/, "");

// minimize
code = (
Expand Down Expand Up @@ -175,7 +178,7 @@ const updateFile = (path, expected) => {
fs.writeFileSync(path, expected, "utf-8");
console.error(`${path} updated`);
} else {
console.error(`${path} need to be updated`);
console.error(`${path} need to be updated\nExpected:\n${expected}`);
process.exitCode = 1;
}
}
Expand Down

0 comments on commit 8ebcbc4

Please sign in to comment.