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

value is not allowed in this context error on merge with additional property #596

Closed
dastrobu opened this issue Dec 17, 2024 · 1 comment · Fixed by #597
Closed

value is not allowed in this context error on merge with additional property #596

dastrobu opened this issue Dec 17, 2024 · 1 comment · Fixed by #597
Labels
bug Something isn't working

Comments

@dastrobu
Copy link

Describe the bug
There is value is not allowed in this context error on merge with an additional property instead of unmarshalling the yaml correctly.

To Reproduce

Unmarshal:

foo: &bar
  biz: buz
mergeMe:
  !!merge <<: *bar
  foo: bar

produces:

Unmarshall() error = [6:3] value is not allowed in this context
           3 |   biz: buz
           4 | mergeMe:
           5 |   !!merge <<: *bar
        >  6 |   foo: bar
                 ^

Expected behavior

The equivalent of the following JSON should be the result:

{
  "mergeMe": {
    "foo": "bar", 
    "biz": "buz"
  }, 
  "foo": {
    "biz": "buz"
  }
}

Verify with https://yaml-online-parser.appspot.com

Screenshots
If applicable, add screenshots to help explain your problem.

Version Variables

  • Go version: 1.23
  • go-yaml's Version: v1.15.10

Additional context
Add any other context about the problem here.

gopkg.in/yaml.v3 can parse the example correctly.

@dastrobu dastrobu added the bug Something isn't working label Dec 17, 2024
@goccy
Copy link
Owner

goccy commented Dec 18, 2024

@dastrobu Thank you for your reports !
This problem was caused by !!merge tag. I've fixed this problem with latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants