Skip to content

ArrayDiff with ExcludePaths incorrectly fails #62

@MaximeJonckheere

Description

@MaximeJonckheere

When comparing an object containing an array, using an exclude path for a property in that array incorrectly returns { "_t": "a" }.

Example:

{
    "User": {
        "Adresses": [
            {
                "Id": "eb369327-2321-4ae2-bb2f-4d74dff1a70d",
                "Street": "Streetname"
            }
        ]
    }
}

In this example, I want to compare this object. But I want to ignore the Id property. Using "User.Adresses[0].Id" in exclude paths, I can ignore this value.

But the result of the Diff is :

{
  "User": {
    "Adresses": {
      "_t": "a"
    }
  }
}

I see the following in the source code in the beginning of the ArrayDiff method:

var result = JObject.Parse(@"{ ""_t"": ""a"" }");

Because there is no difference between the two values (ignoring the excluded paths), this result object is returned. In this case, when there is no difference, this method should return null instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions