|
|
|
|
@ -69,12 +69,6 @@ func (r *DiffFieldReader) readMap(
|
|
|
|
|
resultSet = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Determine what element type the map contains, defaulting to string
|
|
|
|
|
elemType := TypeString
|
|
|
|
|
if et, ok := schema.Elem.(ValueType); ok {
|
|
|
|
|
elemType = et
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Next, read all the elements we have in our diff, and apply
|
|
|
|
|
// the diff to our result.
|
|
|
|
|
prefix := strings.Join(address, ".") + "."
|
|
|
|
|
@ -95,20 +89,12 @@ func (r *DiffFieldReader) readMap(
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Replace the new value with one of the correct Elem type if needed.
|
|
|
|
|
// We don't supported arbitrarily nested schemas, so we can only handle
|
|
|
|
|
// the primitive types here.
|
|
|
|
|
var vNew interface{} = v.New
|
|
|
|
|
switch elemType {
|
|
|
|
|
case TypeBool, TypeInt, TypeFloat:
|
|
|
|
|
v, err := stringToPrimitive(v.New, false, &Schema{Type: elemType})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return FieldReadResult{}, err
|
|
|
|
|
}
|
|
|
|
|
vNew = v
|
|
|
|
|
}
|
|
|
|
|
result[k] = v.New
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result[k] = vNew
|
|
|
|
|
err = mapValuesToPrimitive(result, schema)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return FieldReadResult{}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var resultVal interface{}
|
|
|
|
|
|