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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user