Skip to content

Commit

Permalink
fix(cfnspec): incorrectly handling array result from jsondiff (backport
Browse files Browse the repository at this point in the history
#23795) (#23800)

This is an automatic backport of pull request #23795 done by [Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

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 <destination>` will backport this PR on `<destination>` 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
</details>
  • Loading branch information
mergify[bot] committed Jan 24, 2023
1 parent d0a750b commit ee911ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`);
}
Expand All @@ -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)}`);
Expand Down

0 comments on commit ee911ec

Please sign in to comment.