From ee911ec8abb147d378e0e8f287d131dbfab9501f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 04:54:30 +0000 Subject: [PATCH] fix(cfnspec): incorrectly handling array result from jsondiff (backport #23795) (#23800) This is an automatic backport of pull request #23795 done by [Mergify](https://mergify.com). ---
Mergify commands and options
More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport ` will backport this PR on `` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com
--- packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts b/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts index 86fb8a6145f21..465637b789522 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts @@ -237,6 +237,10 @@ async function main() { if (Array.isArray(update)) { changes.push(`* ${namespace} ${prefix} (__changed__)`); for (const entry of update) { + if (entry.length === 1 && entry[0] === ' ') { + // This means that this element of the array is unchanged + continue; + } if (entry.length !== 2) { throw new Error(`Unexpected array diff entry: ${JSON.stringify(entry)}`); } @@ -247,7 +251,7 @@ async function main() { case '-': throw new Error(`Something awkward happened: ${entry[1]} was deleted from ${namespace} ${prefix}!`); case ' ': - // This entry is "context" + // This entry is "context" break; default: throw new Error(`Unexpected array diff entry: ${JSON.stringify(entry)}`);