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

yq 3 empty keys do not allow merging of values #356

Closed
umotif-shorner opened this issue Feb 12, 2020 · 3 comments
Closed

yq 3 empty keys do not allow merging of values #356

umotif-shorner opened this issue Feb 12, 2020 · 3 comments
Labels
Milestone

Comments

@umotif-shorner
Copy link

Given the following two files

foo:
    hello: world
    bar:
foo:
    bar:
        baz:
            other: value

If i run yq m one.yaml two.yaml, i get the following:

with yq 2.4.1:

foo:
  bar:
    baz:
      other: value
  hello: world

with yq 3.0.1:

foo:
  hello: world
  bar:

Adding any value to the bar key in the first file results in the correct output, as does removing the bar key from the first file. It seems to be related to bar existing as a key, but not having any dictionary values.

I would expect the functionality from 2.x to be preserved, as this has not been mentioned in the "upgrading from 2.x" page, and seems like a fairly large breaking change.

@mikefarah mikefarah added the bug label Feb 13, 2020
@mikefarah
Copy link
Owner

Yeah I had to write my own merge function as the previous library was not going to work (and wouldn't preserve things like formatting and comments). It's not mentioned because it's a bug I didn't pick up :P I'll look into it

@tedslittlerobot
Copy link

tedslittlerobot commented Feb 13, 2020

thanks! I would have a go at fixing it, but while I'd love to get up to scratch with Go, I don't think this is the month i'll have the time to do it...! (sorry - that's me that reported it on another account)

@mikefarah
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants