{"action":"created","issue":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/2721","repository_url":"https://api.github.com/repos/keystonejs/keystone","labels_url":"https://api.github.com/repos/keystonejs/keystone/issues/2721/labels{/name}","comments_url":"https://api.github.com/repos/keystonejs/keystone/issues/2721/comments","events_url":"https://api.github.com/repos/keystonejs/keystone/issues/2721/events","html_url":"https://github.com/keystonejs/keystone/pull/2721","id":152001976,"number":2721,"title":"modified relationship-type's update-item method behavior","user":{"login":"suryagh","id":5177920,"avatar_url":"https://avatars.githubusercontent.com/u/5177920?v=3","gravatar_id":"","url":"https://api.github.com/users/suryagh","html_url":"https://github.com/suryagh","followers_url":"https://api.github.com/users/suryagh/followers","following_url":"https://api.github.com/users/suryagh/following{/other_user}","gists_url":"https://api.github.com/users/suryagh/gists{/gist_id}","starred_url":"https://api.github.com/users/suryagh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryagh/subscriptions","organizations_url":"https://api.github.com/users/suryagh/orgs","repos_url":"https://api.github.com/users/suryagh/repos","events_url":"https://api.github.com/users/suryagh/events{/privacy}","received_events_url":"https://api.github.com/users/suryagh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/keystonejs/keystone/labels/ready","name":"ready","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-30T02:38:52Z","updated_at":"2016-05-02T13:33:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/keystonejs/keystone/pulls/2721","html_url":"https://github.com/keystonejs/keystone/pull/2721","diff_url":"https://github.com/keystonejs/keystone/pull/2721.diff","patch_url":"https://github.com/keystonejs/keystone/pull/2721.patch"},"body":"#2664 \r\n\r\n1.  `updateItem()` method will now `delete` the `field` if the `path` not present in `data` object. This should fix the issue where -  the last item cannot be removed - because the `data` object will not contain the `empty` item.\r\n\r\n2.  Fixed the breaking unit test.\r\n\r\n**Note: please review this carefully before merging.**"},"comment":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/comments/216235989","html_url":"https://github.com/keystonejs/keystone/pull/2721#issuecomment-216235989","issue_url":"https://api.github.com/repos/keystonejs/keystone/issues/2721","id":216235989,"user":{"login":"JedWatson","id":872310,"avatar_url":"https://avatars.githubusercontent.com/u/872310?v=3","gravatar_id":"","url":"https://api.github.com/users/JedWatson","html_url":"https://github.com/JedWatson","followers_url":"https://api.github.com/users/JedWatson/followers","following_url":"https://api.github.com/users/JedWatson/following{/other_user}","gists_url":"https://api.github.com/users/JedWatson/gists{/gist_id}","starred_url":"https://api.github.com/users/JedWatson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JedWatson/subscriptions","organizations_url":"https://api.github.com/users/JedWatson/orgs","repos_url":"https://api.github.com/users/JedWatson/repos","events_url":"https://api.github.com/users/JedWatson/events{/privacy}","received_events_url":"https://api.github.com/users/JedWatson/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T13:33:58Z","updated_at":"2016-05-02T13:33:58Z","body":"This and #2726 are breaking changes...\r\n\r\nPreviously, **only** the `Boolean` field type would have its value updated when `undefined` is passed, which is a concession to HTML forms not submitting anything when a checkbox isn't checked. Other field types require an explicit `null` value to be provided in order to clear out the value, and passing `undefined` skips the update entirely.\r\n\r\nBasically, when exposed as a JSON API (or used internally) this could lead to some really confusing behaviour; you'd usually expect `undefined` to mean \"don't change this field\", and `null` to mean \"clear this field\". It means we can never really safely autodetect which fields to update in an item by their presence, and worse we have inconsistent behaviour between different field types.\r\n\r\nThe alternative way to resolve this is to leave the back-end processing logic as is, and change the way values are submitted from the UI.\r\n\r\nI'm happy to merge this for now, because fundamentally there is a bug that needs to be fixed preventing data from being saved, but the whole spec / behaviour here needs some more discussion."}}