Skip to content

feat(yaml-updater): add ability to append to mapping keys#5394

Open
mihuross wants to merge 1 commit intoakuity:mainfrom
mihuross:mh-yaml-update-add
Open

feat(yaml-updater): add ability to append to mapping keys#5394
mihuross wants to merge 1 commit intoakuity:mainfrom
mihuross:mh-yaml-update-add

Conversation

@mihuross
Copy link
Copy Markdown

If the path points to non existing key in mapping node and would otherwise be a terminal one, add ability to append that key with new value.

I was trying to find a usable implementation somewhere else, but ultimately failed to do so :(

This is a best approach I could come up with, that is minimal and supports adding a new key to mapping node while trying to preserve indentations. This can still screw up formatting rules though (e.g. if formater requires specific key ordering in mapping). For the similar reason, append to empty mapping node is not possible, since it would have to guess what is the correct indentation step.

Adding ability to append to lists might work in similar way.

Related to #5299

As described in the issue, I think this is still rather an edge case to solve (although very useful for me), so adding extra code just for this, might not be a good trade of.

If the path points to non existing key in mapping node and would otherwise be
a terminal one, add ability to append that key with new value.

Signed-off-by: Michal Humpula <michal.humpula@rossum.ai>
@mihuross mihuross requested a review from a team as a code owner November 16, 2025 09:32
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 16, 2025

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit af15a74
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/69199a27b1ea840008eb318d
😎 Deploy Preview https://deploy-preview-5394.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant