package behavior import "gopkg.in/yaml.v3" type DescVariant struct { Text string `yaml:"text"` Condition *Condition `yaml:"condition,omitempty"` } type DescList []DescVariant func (dl *DescList) UnmarshalYAML(value *yaml.Node) error { if value.Kind == yaml.ScalarNode { var s string if err := value.Decode(&s); err != nil { return err } *dl = DescList{{Text: s}} return nil } var entries []DescVariant if err := value.Decode(&entries); err != nil { return err } *dl = entries return nil }