Fix key overriding in regular maps for traversing

This commit is contained in:
Steven WdV
2025-07-20 15:37:45 +02:00
parent 41cc4fb4ac
commit 904215ef4d
5 changed files with 257 additions and 175 deletions
+3 -3
View File
@@ -144,9 +144,6 @@ func reconstructAliasedMap(node *CandidateNode, context Context) error {
// can I short cut here by prechecking if there's an anchor in the map?
// no it needs to recurse in overrideEntry.
if !ConfiguredYamlPreferences.FixMergeAnchorToSpec {
log.Warning("--yaml-fix-merge-anchor-to-spec is false; causing merge anchors to override the existing values which isn't to the yaml spec. This flag will default to true in late 2025.")
}
if ConfiguredYamlPreferences.FixMergeAnchorToSpec {
for index := len(node.Content) - 2; index >= 0; index -= 2 {
keyNode := node.Content[index]
@@ -159,7 +156,10 @@ func reconstructAliasedMap(node *CandidateNode, context Context) error {
}
}
}
} else {
log.Warning("--yaml-fix-merge-anchor-to-spec is false; causing merge anchors to override the existing values which isn't to the yaml spec. This flag will default to true in late 2025.")
}
for index := 0; index < len(node.Content); index = index + 2 {
keyNode := node.Content[index]
valueNode := node.Content[index+1]