{"action":"created","issue":{"url":"https://api.github.com/repos/google/google-api-php-client/issues/411","labels_url":"https://api.github.com/repos/google/google-api-php-client/issues/411/labels{/name}","comments_url":"https://api.github.com/repos/google/google-api-php-client/issues/411/comments","events_url":"https://api.github.com/repos/google/google-api-php-client/issues/411/events","html_url":"https://github.com/google/google-api-php-client/issues/411","id":50135106,"number":411,"title":"Patch a NULL value (for example: All-day event to Timed event)","user":{"login":"mail2rvg","id":4534627,"avatar_url":"https://avatars.githubusercontent.com/u/4534627?v=3","gravatar_id":"","url":"https://api.github.com/users/mail2rvg","html_url":"https://github.com/mail2rvg","followers_url":"https://api.github.com/users/mail2rvg/followers","following_url":"https://api.github.com/users/mail2rvg/following{/other_user}","gists_url":"https://api.github.com/users/mail2rvg/gists{/gist_id}","starred_url":"https://api.github.com/users/mail2rvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mail2rvg/subscriptions","organizations_url":"https://api.github.com/users/mail2rvg/orgs","repos_url":"https://api.github.com/users/mail2rvg/repos","events_url":"https://api.github.com/users/mail2rvg/events{/privacy}","received_events_url":"https://api.github.com/users/mail2rvg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/google-api-php-client/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2014-11-26T09:17:54Z","updated_at":"2015-02-24T21:16:46Z","closed_at":null,"body":"Hi there,\r\n\r\nWe're experiencing an issue when we want to patch the (start/end) Date/DateTime properties of an all-day-event. We want to change it from an all-day event to a timed event.\r\n\r\nWe create a new instance of Google_Service_Calendar_EventDateTime and set the desired DateTime value using the setDateTime method, next we set the Date value to NULL using the setDate method. When patching this event we got this error: 'Invalid or mismatching start and end times'.\r\n\r\nThis is due to the fact the date property isn't present in the request body. The toSimpleObject method in Google_Model class processes all the public properties, but skips the properties that has a NULL value. This would mean we could never patch a property to a NULL value.\r\n\r\nWe tried to disable the NULL value check, so the date property with the NULL value will be placed in the request body. This led to the desired result; the all-day event in Google changed to a timed event.\r\n\r\nWe were wondering if the patch semantics prevent patching a null value, so we read the rfc\r\nhttp://tools.ietf.org/html/rfc5789. It does not seem the case, so this is why we filled this bug report.\r\n\r\nFollowing https://developers.google.com/google-apps/calendar/v3/reference/events the date property is only used for a all-day event.\r\n\r\nThanks in advance\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/google/google-api-php-client/issues/comments/75847881","html_url":"https://github.com/google/google-api-php-client/issues/411#issuecomment-75847881","issue_url":"https://api.github.com/repos/google/google-api-php-client/issues/411","id":75847881,"user":{"login":"dweingart","id":3514416,"avatar_url":"https://avatars.githubusercontent.com/u/3514416?v=3","gravatar_id":"","url":"https://api.github.com/users/dweingart","html_url":"https://github.com/dweingart","followers_url":"https://api.github.com/users/dweingart/followers","following_url":"https://api.github.com/users/dweingart/following{/other_user}","gists_url":"https://api.github.com/users/dweingart/gists{/gist_id}","starred_url":"https://api.github.com/users/dweingart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dweingart/subscriptions","organizations_url":"https://api.github.com/users/dweingart/orgs","repos_url":"https://api.github.com/users/dweingart/repos","events_url":"https://api.github.com/users/dweingart/events{/privacy}","received_events_url":"https://api.github.com/users/dweingart/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T21:16:46Z","updated_at":"2015-02-24T21:16:46Z","body":"This code (stripping null attributes) also causes problems for the Directory API.\r\n\r\nIf you want to clear any of the array attributes of the Google_Service_Directory_User object (like emails, phones, or addresses) setting these properties to the empty array doesn't work. Only sending NULL (in the JSON) works to clear the attribute in my testing.\r\n\r\nHowever, there is no way to set the properties to NULL and have the nulls preserved with the current Google_Model code."}}