{"action":"closed","number":245,"pull_request":{"url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245","id":95859536,"html_url":"https://github.com/katharsis-project/katharsis-framework/pull/245","diff_url":"https://github.com/katharsis-project/katharsis-framework/pull/245.diff","patch_url":"https://github.com/katharsis-project/katharsis-framework/pull/245.patch","issue_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/245","number":245,"state":"closed","locked":false,"title":"#122 Don't call setters on omitted fields during PATCH","user":{"login":"Ramblurr","id":14830,"avatar_url":"https://avatars.githubusercontent.com/u/14830?v=3","gravatar_id":"","url":"https://api.github.com/users/Ramblurr","html_url":"https://github.com/Ramblurr","followers_url":"https://api.github.com/users/Ramblurr/followers","following_url":"https://api.github.com/users/Ramblurr/following{/other_user}","gists_url":"https://api.github.com/users/Ramblurr/gists{/gist_id}","starred_url":"https://api.github.com/users/Ramblurr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ramblurr/subscriptions","organizations_url":"https://api.github.com/users/Ramblurr/orgs","repos_url":"https://api.github.com/users/Ramblurr/repos","events_url":"https://api.github.com/users/Ramblurr/events{/privacy}","received_events_url":"https://api.github.com/users/Ramblurr/received_events","type":"User","site_admin":false},"body":"*(trying out the new PR template from #243)*\r\n<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nDuring a PATCH request with a partial attributes payload, the setters for the omitted attributes would still be called.\r\n\r\n1. This is redundant, as the existing values are already loaded via the `findOne` call\r\n2. It breaks developer expectations that setters of a JsonApiResource are only called for meaningful/semantic business reasons, i.e., that a request was submitted that results in a field being modified.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\nFixes #122. See discussion and examples there.\r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details the tests you ran to, -->\r\n<!--- and how your change affects other areas of the code, etc. -->\r\n\r\nI've added a special test method in `ResourcePatchTest` that explicitly tests this behavior.\r\n\r\n1. `Task` now has an additional attribute called `category`.\r\n2. The category setter throws an exception if null is passed to it (the idea being that null category is not allowed for some business rule reason)\r\n\r\nFor testing:\r\n* A Task object is created that has a null category and a name set.\r\n* A PATCH request is made updating the name, but omitting the category.\r\n\r\nBefore my patch, this test would fail as the exception in the setCategory method would be thrown.\r\nAfter my patch, the exception is not triggered and setCategory is never invoked, which is the expected behavior\r\n\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [x] Bug fix (non-breaking change which fixes an issue)\r\n\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project: no doc changes\r\n- [x] My change requires a change to the documentation: no\r\n- [x] I have updated the documentation accordingly.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [x] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.\r\n\r\n","created_at":"2016-11-30T09:55:34Z","updated_at":"2016-12-06T09:24:30Z","closed_at":"2016-12-06T09:24:30Z","merged_at":"2016-12-06T09:24:30Z","merge_commit_sha":"5742fa0ed16b051c0586269e0fafe698af2bc3b0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245/commits","review_comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245/comments","review_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/245/comments","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/f0fb343fa2dba8bfe781258184f576ba77ce0227","head":{"label":"katharsis-project:122-patching-omitted-fields","ref":"122-patching-omitted-fields","sha":"f0fb343fa2dba8bfe781258184f576ba77ce0227","user":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"repo":{"id":64340716,"name":"katharsis-framework","full_name":"katharsis-project/katharsis-framework","owner":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/katharsis-project/katharsis-framework","description":"Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard","fork":false,"url":"https://api.github.com/repos/katharsis-project/katharsis-framework","forks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/forks","keys_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/teams","hooks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/hooks","issue_events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/events{/number}","events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/events","assignees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/assignees{/user}","branches_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/branches{/branch}","tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/tags","blobs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/languages","stargazers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/stargazers","contributors_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contributors","subscribers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscribers","subscription_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscription","commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contents/{+path}","compare_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/merges","archive_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/downloads","issues_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues{/number}","pulls_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/labels{/name}","releases_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/releases{/id}","deployments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/deployments","created_at":"2016-07-27T20:46:27Z","updated_at":"2016-12-04T23:59:09Z","pushed_at":"2016-12-06T09:24:30Z","git_url":"git://github.com/katharsis-project/katharsis-framework.git","ssh_url":"git@github.com:katharsis-project/katharsis-framework.git","clone_url":"https://github.com/katharsis-project/katharsis-framework.git","svn_url":"https://github.com/katharsis-project/katharsis-framework","homepage":"http://katharsis.io","size":3631,"stargazers_count":42,"watchers_count":42,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":61,"forks":19,"open_issues":61,"watchers":42,"default_branch":"develop"}},"base":{"label":"katharsis-project:develop","ref":"develop","sha":"b3b70fc1eb41112b3625fc75b06c1583a734db31","user":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"repo":{"id":64340716,"name":"katharsis-framework","full_name":"katharsis-project/katharsis-framework","owner":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/katharsis-project/katharsis-framework","description":"Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard","fork":false,"url":"https://api.github.com/repos/katharsis-project/katharsis-framework","forks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/forks","keys_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/teams","hooks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/hooks","issue_events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/events{/number}","events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/events","assignees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/assignees{/user}","branches_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/branches{/branch}","tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/tags","blobs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/languages","stargazers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/stargazers","contributors_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contributors","subscribers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscribers","subscription_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscription","commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contents/{+path}","compare_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/merges","archive_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/downloads","issues_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues{/number}","pulls_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/labels{/name}","releases_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/releases{/id}","deployments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/deployments","created_at":"2016-07-27T20:46:27Z","updated_at":"2016-12-04T23:59:09Z","pushed_at":"2016-12-06T09:24:30Z","git_url":"git://github.com/katharsis-project/katharsis-framework.git","ssh_url":"git@github.com:katharsis-project/katharsis-framework.git","clone_url":"https://github.com/katharsis-project/katharsis-framework.git","svn_url":"https://github.com/katharsis-project/katharsis-framework","homepage":"http://katharsis.io","size":3631,"stargazers_count":42,"watchers_count":42,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":61,"forks":19,"open_issues":61,"watchers":42,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245"},"html":{"href":"https://github.com/katharsis-project/katharsis-framework/pull/245"},"issue":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/245"},"comments":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/245/comments"},"review_comments":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245/comments"},"review_comment":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/245/commits"},"statuses":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/f0fb343fa2dba8bfe781258184f576ba77ce0227"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"Ramblurr","id":14830,"avatar_url":"https://avatars.githubusercontent.com/u/14830?v=3","gravatar_id":"","url":"https://api.github.com/users/Ramblurr","html_url":"https://github.com/Ramblurr","followers_url":"https://api.github.com/users/Ramblurr/followers","following_url":"https://api.github.com/users/Ramblurr/following{/other_user}","gists_url":"https://api.github.com/users/Ramblurr/gists{/gist_id}","starred_url":"https://api.github.com/users/Ramblurr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ramblurr/subscriptions","organizations_url":"https://api.github.com/users/Ramblurr/orgs","repos_url":"https://api.github.com/users/Ramblurr/repos","events_url":"https://api.github.com/users/Ramblurr/events{/privacy}","received_events_url":"https://api.github.com/users/Ramblurr/received_events","type":"User","site_admin":false},"comments":8,"review_comments":3,"commits":2,"additions":71,"deletions":20,"changed_files":3}}
{"actor":{"display_login":"Ramblurr"}}