-
Notifications
You must be signed in to change notification settings - Fork 85
Description
I've got the following inputs and I'm using the JSON Delta formatter:
{
person = new
{
name = "John Doe",
dob = DateTime.Now
},
addresses = new List<string>() { "address 1", "address 2" }
};
dynamic newObject = new
{
person = new
{
name = "Patrick",
},
addresses = new List<string>() { "address 1", "address 3" }
};
The response is:
{"path":"/person/dob","op":"remove","from":null,"value":null}
If I were using the default formatter, I would have for the dob field something like that:
"dob": [
"2021-10-14T15:41:57.7683884-03:00",
0,
0
]
I would expect to be able to have the previous value in the JSON Patch response too.
I'm creating my own formatter inheriting from the JsonDeltaFormatter class and overriding this method:
jsondiffpatch.net/Src/JsonDiffPatchDotNet/Formatters/JsonPatch/JsonDeltaFormatter.cs
Line 18 in d0abb0e
protected override void Format(DeltaType type, JsonFormatContext context, JToken delta, JToken leftValue, string key, string leftKey, MoveDestination movedFrom) |
More specifically this line, that only takes the context into account, without the delta:
jsondiffpatch.net/Src/JsonDiffPatchDotNet/Formatters/JsonPatch/JsonDeltaFormatter.cs
Line 35 in d0abb0e
FormatDeleted(context); |
However, if this is not working as designed I'd rather open a PR.