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
However, I see that v3 of this library parses all the keys into the tree structure.
package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
var deviated = `a:
- b
- c
a:
q: a
q: b
`
func print(root *yaml.Node, num int) {
fmt.Printf("%v: %#v\n", num, root)
for _, child := range root.Content {
print(child, num+1)
}
}
func main() {
root := &yaml.Node{}
err := yaml.Unmarshal([]byte(deviated), root) // Should return either same structure as for string {a: {q: b}}, which is the most logical representation of the data above or some error
if err != nil {
panic(err) // will not panic with current state of library
}
print(root, 0)
}
The text was updated successfully, but these errors were encountered:
Is there an option to ignore the duplicate fields and parse it to the latest field in Yaml?
We have a scenario where some of the yaml templates are configured with duplicate keys by mistake. The Java snakeyaml peoject is ignoring duplicates whereas here we see the error
YAML spec in version 1.2 says that in a valid YAML file, mapping keys “MUST” be unique.
However, I see that v3 of this library parses all the keys into the tree structure.
The text was updated successfully, but these errors were encountered: