When parsing empty arrays from YAML to config objects and unpacking into an untyped representation like map[string]interface{} arrays in the original source are turned into nil. Marshalling back to YAML this turns into null and is thereby not round-trippeable through ucfg:
Consider:
input, err := yaml.Unmarshal(`node.roles: []`)
...
c, err := NewConfig([]byte(input))
...
var output map[string]interface{}
err = c.Unpack(output)
...
yaml.Marshal(output)
leaves us with:
We have been hit in the ECK operator a couple of times by this issue:
We are using untyped map[string]interface{} target data structures in the operator for application configuration because it is difficult for us to model each Elastic stack application's configuration completely and for all versions of the Elastic stack that we need to support.
When parsing empty arrays from YAML to config objects and unpacking into an untyped representation like
map[string]interface{}arrays in the original source are turned intonil. Marshalling back to YAML this turns intonulland is thereby not round-trippeable through ucfg:Consider:
leaves us with:
We have been hit in the ECK operator a couple of times by this issue:
coordinatingnode role Coordinator nodes cannot be defined using node.roles cloud-on-k8s#3718We are using untyped
map[string]interface{}target data structures in the operator for application configuration because it is difficult for us to model each Elastic stack application's configuration completely and for all versions of the Elastic stack that we need to support.