This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
Releases: engity-com/go-yaml
Releases · engity-com/go-yaml
v1.1.0
Highlights
Before we have to live with always break on unknown fields or not, using:
dec := yaml.NewDecoder(f)
dec.KnownFields(true)
With this change we can define a custom function, like:
dec := yaml.NewDecoder(f)
dec.OnUnknownField(func(node *Node, name reflect.Value, out reflect.Value) error {
// Do our stuff...
})
Additionally, this can be also changed for yaml.Node
, like:
func main() {
var mt myType
dec := yaml.NewDecoder(f)
dec.OnUnknownField(func(node *Node, name reflect.Value, out reflect.Value) error {
// Do our stuff...
})
dec.Decode(&mt)
}
func (m *myType) UnmarshalYAML(value *yaml.Node) error {
value.OnUnknownField(func(node *Node, name reflect.Value, out reflect.Value) error {
// Do other stuff...
})
value.Decode(...)
}
What's Changed
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Highlights
Now when using:
func main() {
var mt myType
dec := yaml.NewDecoder(f)
dec.KnownFields(true)
dec.Decode(&mt)
}
func (m *myType) UnmarshalYAML(value *yaml.Node) error {
value.Decode(...) // <- Here the setting dec.KnownFields(true) is not preserved
}
What's Changed
- Prepare standalone to be standalone as github.com/engity-com/go-yaml by @blaubaer in #1
- Improved the tests to reflect improved known fields checks, too by @blaubaer in #2
New Contributors
Full Changelog: https://github.com/engity-com/go-yaml/commits/v1.0.0