go-ordered-map icon indicating copy to clipboard operation
go-ordered-map copied to clipboard

Yaml deserialization of embedded orderedmap: extra fields from parent

Open Antiarchitect opened this issue 1 year ago • 1 comments

Using 2.1.8

Having this struct:

type A struct {
	Defaults string `yaml:"defaults"`
	Others orderedmap.OrderedMap[string, string] `yaml:",inline"`
}

and this YAML:

defaults: "some defaults"
a: "a"
b: "b"

Expecting to get Others with only a and b keys inside, but getting full default, a, b set of keys:

https://go.dev/play/p/RTww5Itk3g4

Standard Go map works as I expect: https://go.dev/play/p/_HkazAAFx-z

Antiarchitect avatar Sep 06 '23 12:09 Antiarchitect

Definitely a bug, thanks for the report :)

Will try to have a look at it when I have time, but in the meantime PRs are always welcome!

wk8 avatar Sep 06 '23 16:09 wk8