Commit 0cf2e13
fix: do not print event diff when the ids have changed (#2252)
Fixes #2248
### Description of the bug
When checking for the database diff, the `eventRootProperty` and
`eventResourcesField` of events were shown as changing like:
```│ └ events
│ ├[~] event aws.autoscaling@EC2InstanceLaunchLifecycleAction
│ │ └ - rootProperty: EC2InstanceLaunchLifecycleAction
│ │ + rootProperty: EC2InstanceLaunchLifecycleAction
│ │ - resourcesField: [EC2InstanceLaunchLifecycleAction.AutoScalingGroupName]
│ │ + resourcesField: [EC2InstanceLaunchLifecycleAction.AutoScalingGroupName]
```
This was caused because they used `JsonEq` for comparison, which also
checked if they has the same `$id` in the db, which is not always true
(e.g. when adding a new resource to the db, ids will change).
### Solution
Do not compare the ids, but use the existing functions to compare the
`EvenTypeDefinition` in these properties.
### Testing
- Ran the diff script on databases where the ids had changed, diff is
now correct.
- Added a unit test
Co-authored-by: Leon Michalski <[email protected]>1 parent 41ca41e commit 0cf2e13
File tree
2 files changed
+47
-2
lines changed- packages/@aws-cdk/service-spec-importers
- src
- test
2 files changed
+47
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
208 | | - | |
| 209 | + | |
| 210 | + | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| |||
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
257 | 276 | | |
258 | 277 | | |
259 | 278 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments