Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support merging object/map attributes #10

Merged
merged 7 commits into from
Nov 20, 2024
Merged

Conversation

bbckr
Copy link
Contributor

@bbckr bbckr commented Nov 19, 2024

Allows optionally merging map keys in block attributes whose value is a map. When unset/false (which is the default), the two maps that will be merged will be overridden with the second map value. When set to true, the keys of the maps will be merged. In other words, for now merging is one level deep given how attributes are represented in HCL, which is a list of tokens. This could eventually be expanded to do a recursively merge on the map values, but this is left out for now.

The interface is non-breaking, since the exported TS merge function optionally allows options to be set. Should behave as normal.

On top of the added functionality, the changes include:

  • Creating a new struct to house the Go Merge function.
  • Creating new structs and classes for the MergeOptions in Go and TS.
  • Updated all tests and added additional test cases.

@bbckr bbckr requested review from colinodell and zhammer November 19, 2024 16:25
@bbckr bbckr linked an issue Nov 19, 2024 that may be closed by this pull request
@bbckr bbckr merged commit a81e996 into main Nov 20, 2024
8 checks passed
@bbckr bbckr deleted the bbckr-merge-nested-map-attr branch November 20, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Support merging Object attributes
3 participants