{"action":"created","issue":{"url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/7","repository_url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net","labels_url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/7/comments","events_url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/7/events","html_url":"https://github.com/khalidsalomao/SimpleHelpers.Net/issues/7","id":155771479,"number":7,"title":"Incorrect handling of sub-collections","user":{"login":"stiiifff","id":723552,"avatar_url":"https://avatars.githubusercontent.com/u/723552?v=3","gravatar_id":"","url":"https://api.github.com/users/stiiifff","html_url":"https://github.com/stiiifff","followers_url":"https://api.github.com/users/stiiifff/followers","following_url":"https://api.github.com/users/stiiifff/following{/other_user}","gists_url":"https://api.github.com/users/stiiifff/gists{/gist_id}","starred_url":"https://api.github.com/users/stiiifff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stiiifff/subscriptions","organizations_url":"https://api.github.com/users/stiiifff/orgs","repos_url":"https://api.github.com/users/stiiifff/repos","events_url":"https://api.github.com/users/stiiifff/events{/privacy}","received_events_url":"https://api.github.com/users/stiiifff/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-19T15:51:23Z","updated_at":"2016-05-21T03:02:05Z","closed_at":"2016-05-21T03:02:05Z","body":"Hi Khalid,\r\n\r\nFirst of all, thanks for the very useful library, I'm using it in a client project. I haven't found another implementation that is as handy and low-ceremony as yours :+1: \r\nI just found a little issue in sub-collections, let me explain it.\r\nIf you have an original object:\r\n`{\r\n  \"Children\": [\r\n    {\r\n      \"Name\": \"Alice\"\r\n    }\r\n  ]\r\n}`\r\nand a modified one:\r\n`{\r\n  \"Children\": [\r\n    {\r\n      \"Name\": \"Alice\"\r\n    },\r\n    {\r\n      \"Name\": \"Bob\"\r\n    }\r\n  ]\r\n}`\r\nIf I do a GenerateDiff and then PatchObject one the original object, I get this:\r\n`{\r\n  \"Children\": [\r\n   {\"Name\": \"Alice\"},\r\n   null\r\n  ]\r\n}`\r\n\r\nI have addressed the issue by making 2 small changes in the Patch method:\r\n'return array' in the block that deals with arrays, 'return sourceObj' in the block that deals with objects, and remove the 'return sourceJson' at the end of the method. Problem is then fixed, and I think the code is a bit less confusing as well.\r\n\r\nAttached is a small unit test that highlights the issue.\r\nWould be awesome if you could integrate this fix, thx :)\r\n\r\n[ObjectDiffPatchArrayIssue.zip](https://github.com/khalidsalomao/SimpleHelpers.Net/files/272919/ObjectDiffPatchArrayIssue.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/comments/220755101","html_url":"https://github.com/khalidsalomao/SimpleHelpers.Net/issues/7#issuecomment-220755101","issue_url":"https://api.github.com/repos/khalidsalomao/SimpleHelpers.Net/issues/7","id":220755101,"user":{"login":"khalidsalomao","id":1336766,"avatar_url":"https://avatars.githubusercontent.com/u/1336766?v=3","gravatar_id":"","url":"https://api.github.com/users/khalidsalomao","html_url":"https://github.com/khalidsalomao","followers_url":"https://api.github.com/users/khalidsalomao/followers","following_url":"https://api.github.com/users/khalidsalomao/following{/other_user}","gists_url":"https://api.github.com/users/khalidsalomao/gists{/gist_id}","starred_url":"https://api.github.com/users/khalidsalomao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khalidsalomao/subscriptions","organizations_url":"https://api.github.com/users/khalidsalomao/orgs","repos_url":"https://api.github.com/users/khalidsalomao/repos","events_url":"https://api.github.com/users/khalidsalomao/events{/privacy}","received_events_url":"https://api.github.com/users/khalidsalomao/received_events","type":"User","site_admin":false},"created_at":"2016-05-21T03:02:04Z","updated_at":"2016-05-21T03:02:04Z","body":"@stiiifff I just updated Nuget.org with a version that should address this problem. Could you check it out?\r\nI applied a patch that @kkostov submitted 5 months ago.\r\nBest!"}}
{"actor":{"display_login":"khalidsalomao"}}