{"action":"created","comment":{"url":"https://api.github.com/repos/Yelp/bravado-core/pulls/comments/74590145","id":74590145,"diff_hunk":"@@ -119,19 +129,32 @@ def marshal_object(swagger_spec, object_spec, object_value):\n     \"\"\"\n     deref = swagger_spec.deref\n \n+    if object_value is None:\n+        if is_prop_nullable(swagger_spec, object_spec):\n+            return None\n+        else:\n+            raise SwaggerMappingError(\n+                'Spec {0} is a required value'.format(object_spec))\n+\n     if not is_dict_like(object_value):\n         raise SwaggerMappingError('Expected dict like type for {0}:{1}'.format(\n             type(object_value), object_value))\n \n+    object_spec = deref(object_spec)\n+    required_fields = object_spec.get('required', [])\n+\n+    # Protect against the case where a parameter with an inline definition\n+    # and a required field is passed to this method.\n+    if isinstance(required_fields, bool):","path":"bravado_core/marshal.py","position":50,"original_position":50,"commit_id":"950ca65faa015d502b56b1129e0163cc5f641a4e","original_commit_id":"950ca65faa015d502b56b1129e0163cc5f641a4e","user":{"login":"zroadhouse-rmn","id":1122680,"avatar_url":"https://avatars.githubusercontent.com/u/1122680?v=3","gravatar_id":"","url":"https://api.github.com/users/zroadhouse-rmn","html_url":"https://github.com/zroadhouse-rmn","followers_url":"https://api.github.com/users/zroadhouse-rmn/followers","following_url":"https://api.github.com/users/zroadhouse-rmn/following{/other_user}","gists_url":"https://api.github.com/users/zroadhouse-rmn/gists{/gist_id}","starred_url":"https://api.github.com/users/zroadhouse-rmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zroadhouse-rmn/subscriptions","organizations_url":"https://api.github.com/users/zroadhouse-rmn/orgs","repos_url":"https://api.github.com/users/zroadhouse-rmn/repos","events_url":"https://api.github.com/users/zroadhouse-rmn/events{/privacy}","received_events_url":"https://api.github.com/users/zroadhouse-rmn/received_events","type":"User","site_admin":false},"body":"I put that code in there since previously the concepts of parameter-required vs object required were mixed up in the code, and I was unsure if there were any callers that might be passing parameters directly to marshal_object.\r\n\r\nI agree that it will obscure issues and will remove it (and the associated test cases).","created_at":"2016-08-12T13:29:37Z","updated_at":"2016-08-12T13:29:37Z","html_url":"https://github.com/Yelp/bravado-core/pull/109#discussion_r74590145","pull_request_url":"https://api.github.com/repos/Yelp/bravado-core/pulls/109","_links":{"self":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/comments/74590145"},"html":{"href":"https://github.com/Yelp/bravado-core/pull/109#discussion_r74590145"},"pull_request":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/109"}}},"pull_request":{"url":"https://api.github.com/repos/Yelp/bravado-core/pulls/109","id":80665238,"html_url":"https://github.com/Yelp/bravado-core/pull/109","diff_url":"https://github.com/Yelp/bravado-core/pull/109.diff","patch_url":"https://github.com/Yelp/bravado-core/pull/109.patch","issue_url":"https://api.github.com/repos/Yelp/bravado-core/issues/109","number":109,"state":"open","locked":false,"title":"Fix to marshalling to better handle x-nullable and required properties","user":{"login":"zroadhouse-rmn","id":1122680,"avatar_url":"https://avatars.githubusercontent.com/u/1122680?v=3","gravatar_id":"","url":"https://api.github.com/users/zroadhouse-rmn","html_url":"https://github.com/zroadhouse-rmn","followers_url":"https://api.github.com/users/zroadhouse-rmn/followers","following_url":"https://api.github.com/users/zroadhouse-rmn/following{/other_user}","gists_url":"https://api.github.com/users/zroadhouse-rmn/gists{/gist_id}","starred_url":"https://api.github.com/users/zroadhouse-rmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zroadhouse-rmn/subscriptions","organizations_url":"https://api.github.com/users/zroadhouse-rmn/orgs","repos_url":"https://api.github.com/users/zroadhouse-rmn/repos","events_url":"https://api.github.com/users/zroadhouse-rmn/events{/privacy}","received_events_url":"https://api.github.com/users/zroadhouse-rmn/received_events","type":"User","site_admin":false},"body":"This is the proposed fix for https://github.com/Yelp/bravado-core/issues/108\r\n\r\nI updated unmarshal to better handle x-nullable properties and added additional test cases to cover the changes.\r\n\r\nThere are a number of remaining issues which I would prefer to leave for someone else to address:\r\n\r\n- Unmarshalling of required non-nullable arrays works when it probably shouldn't (existing behavior)\r\n- I had to make a copy of the dereferenced property specification dictionary to add in the x-nullable flag if present. My experience with serde in the past is that I often needed to pass the property specification in addition to the referenced type information. I chose not to do that here for expediency. The extra dictionary copy could be optimized by refactoring the code to do so.\r\n","created_at":"2016-08-09T17:54:18Z","updated_at":"2016-08-12T13:29:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77be296b4273d5aca1a80a8b37614737e8c233e4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Yelp/bravado-core/pulls/109/commits","review_comments_url":"https://api.github.com/repos/Yelp/bravado-core/pulls/109/comments","review_comment_url":"https://api.github.com/repos/Yelp/bravado-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yelp/bravado-core/issues/109/comments","statuses_url":"https://api.github.com/repos/Yelp/bravado-core/statuses/950ca65faa015d502b56b1129e0163cc5f641a4e","head":{"label":"zroadhouse-rmn:issue-108","ref":"issue-108","sha":"950ca65faa015d502b56b1129e0163cc5f641a4e","user":{"login":"zroadhouse-rmn","id":1122680,"avatar_url":"https://avatars.githubusercontent.com/u/1122680?v=3","gravatar_id":"","url":"https://api.github.com/users/zroadhouse-rmn","html_url":"https://github.com/zroadhouse-rmn","followers_url":"https://api.github.com/users/zroadhouse-rmn/followers","following_url":"https://api.github.com/users/zroadhouse-rmn/following{/other_user}","gists_url":"https://api.github.com/users/zroadhouse-rmn/gists{/gist_id}","starred_url":"https://api.github.com/users/zroadhouse-rmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zroadhouse-rmn/subscriptions","organizations_url":"https://api.github.com/users/zroadhouse-rmn/orgs","repos_url":"https://api.github.com/users/zroadhouse-rmn/repos","events_url":"https://api.github.com/users/zroadhouse-rmn/events{/privacy}","received_events_url":"https://api.github.com/users/zroadhouse-rmn/received_events","type":"User","site_admin":false},"repo":{"id":65239285,"name":"bravado-core","full_name":"zroadhouse-rmn/bravado-core","owner":{"login":"zroadhouse-rmn","id":1122680,"avatar_url":"https://avatars.githubusercontent.com/u/1122680?v=3","gravatar_id":"","url":"https://api.github.com/users/zroadhouse-rmn","html_url":"https://github.com/zroadhouse-rmn","followers_url":"https://api.github.com/users/zroadhouse-rmn/followers","following_url":"https://api.github.com/users/zroadhouse-rmn/following{/other_user}","gists_url":"https://api.github.com/users/zroadhouse-rmn/gists{/gist_id}","starred_url":"https://api.github.com/users/zroadhouse-rmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zroadhouse-rmn/subscriptions","organizations_url":"https://api.github.com/users/zroadhouse-rmn/orgs","repos_url":"https://api.github.com/users/zroadhouse-rmn/repos","events_url":"https://api.github.com/users/zroadhouse-rmn/events{/privacy}","received_events_url":"https://api.github.com/users/zroadhouse-rmn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zroadhouse-rmn/bravado-core","description":null,"fork":true,"url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core","forks_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/forks","keys_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/teams","hooks_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/hooks","issue_events_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/issues/events{/number}","events_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/events","assignees_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/assignees{/user}","branches_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/branches{/branch}","tags_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/tags","blobs_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/statuses/{sha}","languages_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/languages","stargazers_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/stargazers","contributors_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/contributors","subscribers_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/subscribers","subscription_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/subscription","commits_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/contents/{+path}","compare_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/merges","archive_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/downloads","issues_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/issues{/number}","pulls_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/pulls{/number}","milestones_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/milestones{/number}","notifications_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/labels{/name}","releases_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/releases{/id}","deployments_url":"https://api.github.com/repos/zroadhouse-rmn/bravado-core/deployments","created_at":"2016-08-08T21:05:46Z","updated_at":"2016-08-08T21:05:47Z","pushed_at":"2016-08-11T21:57:42Z","git_url":"git://github.com/zroadhouse-rmn/bravado-core.git","ssh_url":"git@github.com:zroadhouse-rmn/bravado-core.git","clone_url":"https://github.com/zroadhouse-rmn/bravado-core.git","svn_url":"https://github.com/zroadhouse-rmn/bravado-core","homepage":null,"size":1184,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Yelp:master","ref":"master","sha":"9ebee25d76a4077a8003dac85d426e11b9fe764d","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":33146014,"name":"bravado-core","full_name":"Yelp/bravado-core","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/bravado-core","description":"","fork":false,"url":"https://api.github.com/repos/Yelp/bravado-core","forks_url":"https://api.github.com/repos/Yelp/bravado-core/forks","keys_url":"https://api.github.com/repos/Yelp/bravado-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/bravado-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/bravado-core/teams","hooks_url":"https://api.github.com/repos/Yelp/bravado-core/hooks","issue_events_url":"https://api.github.com/repos/Yelp/bravado-core/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/bravado-core/events","assignees_url":"https://api.github.com/repos/Yelp/bravado-core/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/bravado-core/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/bravado-core/tags","blobs_url":"https://api.github.com/repos/Yelp/bravado-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/bravado-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/bravado-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/bravado-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/bravado-core/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/bravado-core/languages","stargazers_url":"https://api.github.com/repos/Yelp/bravado-core/stargazers","contributors_url":"https://api.github.com/repos/Yelp/bravado-core/contributors","subscribers_url":"https://api.github.com/repos/Yelp/bravado-core/subscribers","subscription_url":"https://api.github.com/repos/Yelp/bravado-core/subscription","commits_url":"https://api.github.com/repos/Yelp/bravado-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/bravado-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/bravado-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/bravado-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/bravado-core/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/bravado-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/bravado-core/merges","archive_url":"https://api.github.com/repos/Yelp/bravado-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/bravado-core/downloads","issues_url":"https://api.github.com/repos/Yelp/bravado-core/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/bravado-core/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/bravado-core/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/bravado-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/bravado-core/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/bravado-core/releases{/id}","deployments_url":"https://api.github.com/repos/Yelp/bravado-core/deployments","created_at":"2015-03-30T20:23:27Z","updated_at":"2016-08-08T22:25:30Z","pushed_at":"2016-08-11T21:57:43Z","git_url":"git://github.com/Yelp/bravado-core.git","ssh_url":"git@github.com:Yelp/bravado-core.git","clone_url":"https://github.com/Yelp/bravado-core.git","svn_url":"https://github.com/Yelp/bravado-core","homepage":null,"size":1189,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":17,"forks":34,"open_issues":17,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/109"},"html":{"href":"https://github.com/Yelp/bravado-core/pull/109"},"issue":{"href":"https://api.github.com/repos/Yelp/bravado-core/issues/109"},"comments":{"href":"https://api.github.com/repos/Yelp/bravado-core/issues/109/comments"},"review_comments":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/109/comments"},"review_comment":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yelp/bravado-core/pulls/109/commits"},"statuses":{"href":"https://api.github.com/repos/Yelp/bravado-core/statuses/950ca65faa015d502b56b1129e0163cc5f641a4e"}}}}
{"actor":{"display_login":"zroadhouse-rmn"}}