You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The features supported in Options like ExcludePath and DiffBehaviors are effectively ignored since JToken.DeepEquals doesn't take those into account.
If you exclude a path that would show up in an DeepEquals array scan, DeepEquals will still return false, even if every other path is valid. The same thing for IgnoreMissingProperties or IgnoreNewProperties.
Assuming you're not interested in writing your own DeepEquals, building an interface around that so that users can write their own would be helpful.
The text was updated successfully, but these errors were encountered:
var json1 = (JToken)JsonConvert.DeserializeObject("[{\"id\":1,\"data\":100},{\"id\":2,\"data\":200},{\"id\":3,\"data\":300}]"); var json2 = (JToken)JsonConvert.DeserializeObject("[{\"id\":2,\"data\":200},{\"id\":3,\"data\":300}]"); Options options = new Options() { DiffBehaviors = DiffBehavior.IgnoreNewProperties }; var jdb = new JsonDiffPatch(); var patch = jdb.Diff(json1, json2);
If you run this, you'll see Diff will simply delete id 1 as expected. Add another property like so and you'll get very different results, despite the fact that IgnoreNewProperties is set.
var json2 = (JToken)JsonConvert.DeserializeObject("[{\"id\":2,\"data\":200,\"more\":20},{\"id\":3,\"data\":300}]");
The features supported in Options like ExcludePath and DiffBehaviors are effectively ignored since JToken.DeepEquals doesn't take those into account.
If you exclude a path that would show up in an DeepEquals array scan, DeepEquals will still return false, even if every other path is valid. The same thing for IgnoreMissingProperties or IgnoreNewProperties.
Assuming you're not interested in writing your own DeepEquals, building an interface around that so that users can write their own would be helpful.
The text was updated successfully, but these errors were encountered: