Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayDiff with ExcludePaths incorrectly fails #62

Open
MaximeJonckheere opened this issue Feb 16, 2022 · 1 comment
Open

ArrayDiff with ExcludePaths incorrectly fails #62

MaximeJonckheere opened this issue Feb 16, 2022 · 1 comment

Comments

@MaximeJonckheere
Copy link

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.

@TomaszSiudak
Copy link

Same issue relevant for me :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants