From af3571c4a40a8bbf7621901834b0eca77bb7569d Mon Sep 17 00:00:00 2001 From: Brandon Siegel Date: Mon, 20 Aug 2018 11:51:48 -0700 Subject: [PATCH] Fix up output from OAD, it does not output valid JSON --- scripts/breaking-change.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/breaking-change.js b/scripts/breaking-change.js index 64c6a4df114d..b9ca4621f4f6 100644 --- a/scripts/breaking-change.js +++ b/scripts/breaking-change.js @@ -65,13 +65,16 @@ async function runOad(oldSpec, newSpec) { console.log(`New Spec: "${newSpec}"`); console.log(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`); - const result = await oad.compare(oldSpec, newSpec, { consoleLogLevel: 'warn', json: true }); + let result = await oad.compare(oldSpec, newSpec, { consoleLogLevel: 'warn', json: true }); console.log(result); if (!result) { return; } + // fix up output from OAD, it does not output valid JSON + result = '[' + result.replace(/}\s+{/gi,"},{") + ']' + return JSON.parse(result); }