You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to merge a YAML file containing a map (dictionary) into another YAML file using the *? operator (merge on existing keys). Instead of merging in the map items, however, an empty map is produced.
Version of yq: 4.9.8
Operating system: Mac OS X (Big Sur)
Installed via: brew
Additional context
The * works fine per se, but of course ignores the existing key constraint which is what I need for my specific case. (Omitted from my examples above to keep the reproduction as simple as possible.)
The text was updated successfully, but these errors were encountered:
Yeah I see, this is a bit tricky - merge runs recursively, and the ? flag means it shouldn't create new keys. As it recurses, it will first encounter thing it will switch the type from a scalar to a map, making it empty. Next it will encounter field1 and try to update that in thing - however, thing is empty and does not have that field, so it skips over it.
Hello 👋
Describe the bug
I am trying to merge a YAML file containing a map (dictionary) into another YAML file using the
*?
operator (merge on existing keys). Instead of merging in the map items, however, an empty map is produced.Version of yq: 4.9.8
Operating system: Mac OS X (Big Sur)
Installed via: brew
Input Yaml
1.yaml:
2.yaml:
Command
Actual behavior
Expected behavior
Additional context
The
*
works fine per se, but of course ignores the existing key constraint which is what I need for my specific case. (Omitted from my examples above to keep the reproduction as simple as possible.)The text was updated successfully, but these errors were encountered: