-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 7.10
-
Component/s: Core
-
Tags:
-
Backlog priority:500
-
Upgrade notes:
-
Sprint:nxFG 8.2.2, nxFG 8.3.1, nxFG 8.3.2, nxFG 8.3.3, nxFG 8.4.1, nxFG 8.4.2, nxFG 8.4.4, nxFG 8.10.2, nxFG 9.1.4, nxFG 9.1.6, nxFG 9.1.7, nxFG 9.1.8, nxFG 9.3.2, nxFG 9.3.1
-
Story Points:3
We have the following behavior currently in 8.10 and 7.10:
If we have a doc with a complex property of {"foo": "foo1", "bar": "bar1"} and set the complex property (using setPropertyValue) to {"bar": "bar2"} then re-reading the property gives {"foo": "foo1", "bar": "bar2"}.
Let's denote this by:
{"foo": "foo1", "bar": "bar1"} & {"bar": "bar2"} -> {"foo": "foo1", "bar": "bar2"}
This means that setProperty actually does an update and not a replace, which IMHO unexpected.
If we have a list of complex properties, the behavior is basically the same.
So in 7.10/8.10 we have:
{"foo": "foo1", "bar": "bar1"} & {"bar": "bar2"} -> {"foo": "foo1", "bar": "bar2"} [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"foo": "foo1", "bar": "bar2"}]
However previously in 6.0 and before we had a different and internally inconsistent behavior:
{"foo": "foo1", "bar": "bar1"} & {"bar": "bar2"} -> {"foo": "foo1", "bar": "bar2"} [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"bar": "bar2"}]
So the list case behaved like a replace while the direct complex property case behaved like an update.
None of this is satisfactory. Ideally this is the behavior we want because it provides the least surprise:
{"foo": "foo1", "bar": "bar1"} & {"bar": "bar2"} -> {"bar": "bar2"} [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"bar": "bar2"}]
The question is how to deal with backward compatibility...
Note that someone that really wants to update just a sub-property and not replace the other fields can always just do that using doc.getProperty("complex/foo").setValue("foo2").