aws-cloudformation / rain

A development workflow tool for working with AWS CloudFormation.
Apache License 2.0
750 stars 69 forks source link

Package Command Should Preserve Map Key Order #369

Closed null93 closed 2 months ago

null93 commented 2 months ago

Issue #, if available:

Fixes aws-cloudformation/rain#362

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

ericzbeard commented 2 months ago

Looks like this change broke anchors. Maybe we need to look for another way to support anchors, since the Decode/Encode was an expedient solution that had unwanted side effects (like losing line numbers).

null93 commented 2 months ago

Didn't see that coming lol. I can take another look later to see what I can come up with.

null93 commented 2 months ago

@ericzbeard

I think I got it to work. I had to modify the test file as well since order needed to be reflected in the expected result (and style).

I added a visitor package under cft and used it to manually resolve the alias nodes. I still had to Marshal and Unmarshal the result so line/column numbers get updated on the anchored nodes.

Let me know if anything needs changing.

null93 commented 2 months ago

@ericzbeard Thanks for merging this PR in! Does this project release on a certain schedule? I am just wondering when the next release will be with this fix implemented.

null93 commented 2 months ago

@ericzbeard ^^ Any idea when the next release will be? 😃

ericzbeard commented 2 months ago

I'll get one out today or tomorrow. No schedule, just whenever there are features and fixes ready to go out.

ericzbeard commented 2 months ago

https://github.com/aws-cloudformation/rain/releases/tag/v1.8.6