1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-02 07:44:51 +00:00

Differentiate between empty and nil arrays

Prior, empty array were converted to nil. In some cases the
difference between a nil and empty array are not arbitrary.
Now, empty arrays will be converted to empty interface arrays
and nil array will be converted to nil interface arrays.
This commit is contained in:
rmweir
2020-08-20 15:28:04 -07:00
parent 261460ee90
commit 5a269325d1

View File

@@ -447,6 +447,10 @@ func (b *Builder) convertArray(fieldType string, value interface{}, op Operation
}
var result []interface{}
if value == nil {
return result, nil
}
result = make([]interface{}, 0)
subType := definition.SubType(fieldType)
for _, value := range sliceValue {