OPA 0.53: object.union_n
would change the nested objects of the objects passed in
#5975
Labels
object.union_n
would change the nested objects of the objects passed in
#5975
Short description
Based on the documentation which does not mention any side effect, I think when
object.union_n
is used to merge an array of objects, it should not change any of the objects being passed into the function, including the nested objects. The original objects should stay the same after calling the function.However, the current implementation of
object.union_n
would cause the original objects being passed in to change, which is not mentioned in the doc. I do think this is a bug withobject.union_n
.If this is intended, please document how the original objects should be changed and any side effects it would cause.
Steps To Reproduce
object
b
's nested objectspec
now contains"key_a": "Should belong to A ONLY"
which means that objectb
has been modifiedExpected behavior
object
b
should stay as{"spec": {"key_b": "Should belong to B ONLY"}}
afterobject.union_n
Additional context
The text was updated successfully, but these errors were encountered: