{"action":"opened","number":419,"pull_request":{"url":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419","id":268821064,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY4ODIxMDY0","html_url":"https://github.com/kogosoftwarellc/open-api/pull/419","diff_url":"https://github.com/kogosoftwarellc/open-api/pull/419.diff","patch_url":"https://github.com/kogosoftwarellc/open-api/pull/419.patch","issue_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/419","number":419,"state":"open","locked":false,"title":"Fix media type checking for request bodies","user":{"login":"jfinkhaeuser","id":203885,"node_id":"MDQ6VXNlcjIwMzg4NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/203885?v=4","gravatar_id":"","url":"https://api.github.com/users/jfinkhaeuser","html_url":"https://github.com/jfinkhaeuser","followers_url":"https://api.github.com/users/jfinkhaeuser/followers","following_url":"https://api.github.com/users/jfinkhaeuser/following{/other_user}","gists_url":"https://api.github.com/users/jfinkhaeuser/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinkhaeuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinkhaeuser/subscriptions","organizations_url":"https://api.github.com/users/jfinkhaeuser/orgs","repos_url":"https://api.github.com/users/jfinkhaeuser/repos","events_url":"https://api.github.com/users/jfinkhaeuser/events{/privacy}","received_events_url":"https://api.github.com/users/jfinkhaeuser/received_events","type":"User","site_admin":false},"body":"Fixes #418 \r\n\r\nThe reasoning behind the patch is the following (may be wrong, let me know):\r\n\r\n1. If a request body is required, we can error out immediately if there isn't any - there is no need for checking the media type. In fact, checking the media type only if a request body is required seems to contradict the specs.\r\n1. An *empty* request body may indicate that it hasn't been parsed, perhaps because it wasn't to parse. So we need to ensure the request is at least `readable` before accepting it.\r\n\r\nThe latter point is a little tricky.\r\n\r\nFrom what I can tell, any parsed request body would go into the first branch, where `request.body` is set and contains values. That can then be validated against the schema, and shouldn't break anything.\r\n\r\nIf `request.body` isn't set - well, honestly I don't know why. So I'm assuming the request body just hasn't been parsed, and the `{}` it's set to is a default value, and this assumption may be wrong.\r\n\r\nBut based on this assumption, for supporting file uploads that are binary strings, we need a readable request. If that doesn't exist, there must be a mistake.\r\n\r\nWhat this change *does not* do is check that in the latter case, the schema is actually for binary strings - that should probably be added, I guess.\r\n\r\nWDYT?","created_at":"2019-04-09T16:47:57Z","updated_at":"2019-04-09T16:47:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419/commits","review_comments_url":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419/comments","review_comment_url":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/419/comments","statuses_url":"https://api.github.com/repos/kogosoftwarellc/open-api/statuses/2e5b57d74efb9d436692464b5955051d36e851e4","head":{"label":"jfinkhaeuser:issue-418-fix","ref":"issue-418-fix","sha":"2e5b57d74efb9d436692464b5955051d36e851e4","user":{"login":"jfinkhaeuser","id":203885,"node_id":"MDQ6VXNlcjIwMzg4NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/203885?v=4","gravatar_id":"","url":"https://api.github.com/users/jfinkhaeuser","html_url":"https://github.com/jfinkhaeuser","followers_url":"https://api.github.com/users/jfinkhaeuser/followers","following_url":"https://api.github.com/users/jfinkhaeuser/following{/other_user}","gists_url":"https://api.github.com/users/jfinkhaeuser/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinkhaeuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinkhaeuser/subscriptions","organizations_url":"https://api.github.com/users/jfinkhaeuser/orgs","repos_url":"https://api.github.com/users/jfinkhaeuser/repos","events_url":"https://api.github.com/users/jfinkhaeuser/events{/privacy}","received_events_url":"https://api.github.com/users/jfinkhaeuser/received_events","type":"User","site_admin":false},"repo":{"id":180408797,"node_id":"MDEwOlJlcG9zaXRvcnkxODA0MDg3OTc=","name":"open-api","full_name":"jfinkhaeuser/open-api","private":false,"owner":{"login":"jfinkhaeuser","id":203885,"node_id":"MDQ6VXNlcjIwMzg4NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/203885?v=4","gravatar_id":"","url":"https://api.github.com/users/jfinkhaeuser","html_url":"https://github.com/jfinkhaeuser","followers_url":"https://api.github.com/users/jfinkhaeuser/followers","following_url":"https://api.github.com/users/jfinkhaeuser/following{/other_user}","gists_url":"https://api.github.com/users/jfinkhaeuser/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinkhaeuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinkhaeuser/subscriptions","organizations_url":"https://api.github.com/users/jfinkhaeuser/orgs","repos_url":"https://api.github.com/users/jfinkhaeuser/repos","events_url":"https://api.github.com/users/jfinkhaeuser/events{/privacy}","received_events_url":"https://api.github.com/users/jfinkhaeuser/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jfinkhaeuser/open-api","description":"A Monorepo of various packages to power OpenAPI in node","fork":true,"url":"https://api.github.com/repos/jfinkhaeuser/open-api","forks_url":"https://api.github.com/repos/jfinkhaeuser/open-api/forks","keys_url":"https://api.github.com/repos/jfinkhaeuser/open-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jfinkhaeuser/open-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jfinkhaeuser/open-api/teams","hooks_url":"https://api.github.com/repos/jfinkhaeuser/open-api/hooks","issue_events_url":"https://api.github.com/repos/jfinkhaeuser/open-api/issues/events{/number}","events_url":"https://api.github.com/repos/jfinkhaeuser/open-api/events","assignees_url":"https://api.github.com/repos/jfinkhaeuser/open-api/assignees{/user}","branches_url":"https://api.github.com/repos/jfinkhaeuser/open-api/branches{/branch}","tags_url":"https://api.github.com/repos/jfinkhaeuser/open-api/tags","blobs_url":"https://api.github.com/repos/jfinkhaeuser/open-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jfinkhaeuser/open-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jfinkhaeuser/open-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/jfinkhaeuser/open-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jfinkhaeuser/open-api/statuses/{sha}","languages_url":"https://api.github.com/repos/jfinkhaeuser/open-api/languages","stargazers_url":"https://api.github.com/repos/jfinkhaeuser/open-api/stargazers","contributors_url":"https://api.github.com/repos/jfinkhaeuser/open-api/contributors","subscribers_url":"https://api.github.com/repos/jfinkhaeuser/open-api/subscribers","subscription_url":"https://api.github.com/repos/jfinkhaeuser/open-api/subscription","commits_url":"https://api.github.com/repos/jfinkhaeuser/open-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/jfinkhaeuser/open-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/jfinkhaeuser/open-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/jfinkhaeuser/open-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/jfinkhaeuser/open-api/contents/{+path}","compare_url":"https://api.github.com/repos/jfinkhaeuser/open-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jfinkhaeuser/open-api/merges","archive_url":"https://api.github.com/repos/jfinkhaeuser/open-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jfinkhaeuser/open-api/downloads","issues_url":"https://api.github.com/repos/jfinkhaeuser/open-api/issues{/number}","pulls_url":"https://api.github.com/repos/jfinkhaeuser/open-api/pulls{/number}","milestones_url":"https://api.github.com/repos/jfinkhaeuser/open-api/milestones{/number}","notifications_url":"https://api.github.com/repos/jfinkhaeuser/open-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jfinkhaeuser/open-api/labels{/name}","releases_url":"https://api.github.com/repos/jfinkhaeuser/open-api/releases{/id}","deployments_url":"https://api.github.com/repos/jfinkhaeuser/open-api/deployments","created_at":"2019-04-09T16:33:16Z","updated_at":"2019-04-09T16:41:46Z","pushed_at":"2019-04-09T16:42:20Z","git_url":"git://github.com/jfinkhaeuser/open-api.git","ssh_url":"git@github.com:jfinkhaeuser/open-api.git","clone_url":"https://github.com/jfinkhaeuser/open-api.git","svn_url":"https://github.com/jfinkhaeuser/open-api","homepage":"","size":2053,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kogosoftwarellc:master","ref":"master","sha":"2d985797f09d7a2596cbd569f3fed080e600171f","user":{"login":"kogosoftwarellc","id":15419153,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDE5MTUz","avatar_url":"https://avatars0.githubusercontent.com/u/15419153?v=4","gravatar_id":"","url":"https://api.github.com/users/kogosoftwarellc","html_url":"https://github.com/kogosoftwarellc","followers_url":"https://api.github.com/users/kogosoftwarellc/followers","following_url":"https://api.github.com/users/kogosoftwarellc/following{/other_user}","gists_url":"https://api.github.com/users/kogosoftwarellc/gists{/gist_id}","starred_url":"https://api.github.com/users/kogosoftwarellc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogosoftwarellc/subscriptions","organizations_url":"https://api.github.com/users/kogosoftwarellc/orgs","repos_url":"https://api.github.com/users/kogosoftwarellc/repos","events_url":"https://api.github.com/users/kogosoftwarellc/events{/privacy}","received_events_url":"https://api.github.com/users/kogosoftwarellc/received_events","type":"Organization","site_admin":false},"repo":{"id":48869446,"node_id":"MDEwOlJlcG9zaXRvcnk0ODg2OTQ0Ng==","name":"open-api","full_name":"kogosoftwarellc/open-api","private":false,"owner":{"login":"kogosoftwarellc","id":15419153,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDE5MTUz","avatar_url":"https://avatars0.githubusercontent.com/u/15419153?v=4","gravatar_id":"","url":"https://api.github.com/users/kogosoftwarellc","html_url":"https://github.com/kogosoftwarellc","followers_url":"https://api.github.com/users/kogosoftwarellc/followers","following_url":"https://api.github.com/users/kogosoftwarellc/following{/other_user}","gists_url":"https://api.github.com/users/kogosoftwarellc/gists{/gist_id}","starred_url":"https://api.github.com/users/kogosoftwarellc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogosoftwarellc/subscriptions","organizations_url":"https://api.github.com/users/kogosoftwarellc/orgs","repos_url":"https://api.github.com/users/kogosoftwarellc/repos","events_url":"https://api.github.com/users/kogosoftwarellc/events{/privacy}","received_events_url":"https://api.github.com/users/kogosoftwarellc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kogosoftwarellc/open-api","description":"A Monorepo of various packages to power OpenAPI in node","fork":false,"url":"https://api.github.com/repos/kogosoftwarellc/open-api","forks_url":"https://api.github.com/repos/kogosoftwarellc/open-api/forks","keys_url":"https://api.github.com/repos/kogosoftwarellc/open-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kogosoftwarellc/open-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kogosoftwarellc/open-api/teams","hooks_url":"https://api.github.com/repos/kogosoftwarellc/open-api/hooks","issue_events_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/events{/number}","events_url":"https://api.github.com/repos/kogosoftwarellc/open-api/events","assignees_url":"https://api.github.com/repos/kogosoftwarellc/open-api/assignees{/user}","branches_url":"https://api.github.com/repos/kogosoftwarellc/open-api/branches{/branch}","tags_url":"https://api.github.com/repos/kogosoftwarellc/open-api/tags","blobs_url":"https://api.github.com/repos/kogosoftwarellc/open-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kogosoftwarellc/open-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kogosoftwarellc/open-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/kogosoftwarellc/open-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kogosoftwarellc/open-api/statuses/{sha}","languages_url":"https://api.github.com/repos/kogosoftwarellc/open-api/languages","stargazers_url":"https://api.github.com/repos/kogosoftwarellc/open-api/stargazers","contributors_url":"https://api.github.com/repos/kogosoftwarellc/open-api/contributors","subscribers_url":"https://api.github.com/repos/kogosoftwarellc/open-api/subscribers","subscription_url":"https://api.github.com/repos/kogosoftwarellc/open-api/subscription","commits_url":"https://api.github.com/repos/kogosoftwarellc/open-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/kogosoftwarellc/open-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/kogosoftwarellc/open-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/kogosoftwarellc/open-api/contents/{+path}","compare_url":"https://api.github.com/repos/kogosoftwarellc/open-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kogosoftwarellc/open-api/merges","archive_url":"https://api.github.com/repos/kogosoftwarellc/open-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kogosoftwarellc/open-api/downloads","issues_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues{/number}","pulls_url":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls{/number}","milestones_url":"https://api.github.com/repos/kogosoftwarellc/open-api/milestones{/number}","notifications_url":"https://api.github.com/repos/kogosoftwarellc/open-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kogosoftwarellc/open-api/labels{/name}","releases_url":"https://api.github.com/repos/kogosoftwarellc/open-api/releases{/id}","deployments_url":"https://api.github.com/repos/kogosoftwarellc/open-api/deployments","created_at":"2016-01-01T04:28:48Z","updated_at":"2019-04-08T23:43:02Z","pushed_at":"2019-04-08T23:43:03Z","git_url":"git://github.com/kogosoftwarellc/open-api.git","ssh_url":"git@github.com:kogosoftwarellc/open-api.git","clone_url":"https://github.com/kogosoftwarellc/open-api.git","svn_url":"https://github.com/kogosoftwarellc/open-api","homepage":"","size":2053,"stargazers_count":236,"watchers_count":236,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":26,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":83,"open_issues":26,"watchers":236,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419"},"html":{"href":"https://github.com/kogosoftwarellc/open-api/pull/419"},"issue":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/419"},"comments":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/419/comments"},"review_comments":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419/comments"},"review_comment":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/pulls/419/commits"},"statuses":{"href":"https://api.github.com/repos/kogosoftwarellc/open-api/statuses/2e5b57d74efb9d436692464b5955051d36e851e4"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"draft","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":22,"deletions":21,"changed_files":1}}
{"actor":{"display_login":"jfinkhaeuser"}}