Skip to content

Commit

Permalink
added logs for visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
timolegros committed Oct 18, 2024
1 parent 5b9e3d2 commit f2b5080
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ async function validateExternalApiVersioning() {
? parseSemVer(newOas.info.version)
: parseSemVer(process.argv[2]);

console.log(
`Files downloaded and versions parsed. \nNew Version: ${newVersion}\nOld Version: ${oldVersion}`,
);

if (oldVersion.major < newVersion.major) {
if (newVersion.minor !== 0 || newVersion.patch !== 0) {
const newMajorVersion = `${newVersion.major}.0.0`;
Expand All @@ -145,6 +149,7 @@ async function validateExternalApiVersioning() {
`Bumped OAS version from ${readableVersion(oldVersion)} to ${newMajorVersion}`,
);
}
console.log('Major version already bumped.');
return; // Breaking change, this is valid regardless of schema changes
}

Expand All @@ -161,6 +166,7 @@ async function validateExternalApiVersioning() {
},
});
await Promise.all([unlink(productionOasPath), unlink(localOasPath)]);
console.log('OpenAPI spec diff:', result);

if (result.breakingDifferencesFound) {
throw Error('External API has breaking changes, update the Major version');
Expand Down

0 comments on commit f2b5080

Please sign in to comment.