Closed JulissaDantes closed 6 months ago
Is there a test that reproduces the issue you are trying to solve here, using the standard
ModelInstanceDocument.replace
method? That method already constructs the json-patch to only include fields that actually changed, so I'm not sure how this could ever be a problem in practice.
Yes regarding the test, I changed the model for the set test to include an immutable field. The jsonpatch construction is not the problem, its how we validate immutability on locked fields, thats why we now will compare the previous value with the value post jsonpatch.
Also this is a problem we are currently having, you can check the linear task for a step by step reproduction, those steps will trigger the ModelInstanceDocument.replace
method.
Description
We used the payload data to determine if an immutable field was being altered, but this caused 2 problems:
upsert
command will always throw if creating a new record for a model with an immutable field. e.g. ComposeDB