{"action":"created","comment":{"url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/comments/115849169","pull_request_review_id":37424824,"id":115849169,"diff_hunk":"@@ -3012,6 +3012,125 @@ schemas:\n       - packSize\n ```\n \n+#### <a name=\"discriminatorObject\"></a>Discriminator Object\n+\n+When request bodies or response payloads may be one of a number of different schemas, a `discriminator` property can be used to aid in serialization, deserialization, and validation.  The discriminator is a specific property in an object which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.\n+\n+##### Fixed Fields\n+Field Name | Type | Description\n+---|:---:|---\n+<a name=\"propertyName\"></a>propertyName | `string` | **required** the name of the property in the payload that will hold the discriminator value.\n+<a name=\"discriminatorMapping\"></a> mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references.\n+\n+The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`.\n+\n+In OAS 3.0, a response payload may be described to be exactly one of any number of types:\n+\n+```\n+MyResponseType:\n+  oneOf:\n+  - $ref: '#/components/schemas/Cat'\n+  - $ref: '#/components/schemas/Dog'\n+  - $ref: '#/components/schemas/Lizard'\n+```\n+\n+which means the paylod _must_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`.  In this case, a discriminator will act as a \"hint\" to bypass validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:\n+\n+\n+```\n+MyResponseType:\n+  oneOf:\n+  - $ref: '#/components/schemas/Cat'\n+  - $ref: '#/components/schemas/Dog'\n+  - $ref: '#/components/schemas/Lizard'\n+  discriminator:\n+    property: pet_type\n+```\n+\n+The expectation now is that a property with name `pet_type` _must_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document.  Thus the response payload:\n+\n+```\n+{\n+  \"id\": 12345,\n+  \"pet_type\": \"Cat\"\n+}\n+```\n+\n+Will indicate that the `Cat` schema be used in conjunction with this payload.\n+\n+In scenarios where the value of the discriminator field does not match the schema name, an optional `mapping` definition may be used:","path":"versions/3.0.md","position":50,"original_position":50,"commit_id":"30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0","original_commit_id":"30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0","user":{"login":"whitlockjc","id":98899,"avatar_url":"https://avatars1.githubusercontent.com/u/98899?v=3","gravatar_id":"","url":"https://api.github.com/users/whitlockjc","html_url":"https://github.com/whitlockjc","followers_url":"https://api.github.com/users/whitlockjc/followers","following_url":"https://api.github.com/users/whitlockjc/following{/other_user}","gists_url":"https://api.github.com/users/whitlockjc/gists{/gist_id}","starred_url":"https://api.github.com/users/whitlockjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitlockjc/subscriptions","organizations_url":"https://api.github.com/users/whitlockjc/orgs","repos_url":"https://api.github.com/users/whitlockjc/repos","events_url":"https://api.github.com/users/whitlockjc/events{/privacy}","received_events_url":"https://api.github.com/users/whitlockjc/received_events","type":"User","site_admin":false},"body":"What happens if the discriminator value does not match a schema or mapping?  We should probably document this as it will impact tooling.","created_at":"2017-05-10T20:50:10Z","updated_at":"2017-05-10T20:50:10Z","html_url":"https://github.com/OAI/OpenAPI-Specification/pull/1093#discussion_r115849169","pull_request_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093","_links":{"self":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/comments/115849169"},"html":{"href":"https://github.com/OAI/OpenAPI-Specification/pull/1093#discussion_r115849169"},"pull_request":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093"}}},"pull_request":{"url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093","id":119551228,"html_url":"https://github.com/OAI/OpenAPI-Specification/pull/1093","diff_url":"https://github.com/OAI/OpenAPI-Specification/pull/1093.diff","patch_url":"https://github.com/OAI/OpenAPI-Specification/pull/1093.patch","issue_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/1093","number":1093,"state":"open","locked":false,"title":"documented the discriminator property","user":{"login":"fehguy","id":249413,"avatar_url":"https://avatars0.githubusercontent.com/u/249413?v=3","gravatar_id":"","url":"https://api.github.com/users/fehguy","html_url":"https://github.com/fehguy","followers_url":"https://api.github.com/users/fehguy/followers","following_url":"https://api.github.com/users/fehguy/following{/other_user}","gists_url":"https://api.github.com/users/fehguy/gists{/gist_id}","starred_url":"https://api.github.com/users/fehguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fehguy/subscriptions","organizations_url":"https://api.github.com/users/fehguy/orgs","repos_url":"https://api.github.com/users/fehguy/repos","events_url":"https://api.github.com/users/fehguy/events{/privacy}","received_events_url":"https://api.github.com/users/fehguy/received_events","type":"User","site_admin":false},"body":"Fixes #1085 ","created_at":"2017-05-08T22:50:25Z","updated_at":"2017-05-10T20:50:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b33ee7bb5af237069b06f5cb4f3b4eaabe98cdfd","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/OAI/OpenAPI-Specification/milestones/7","html_url":"https://github.com/OAI/OpenAPI-Specification/milestone/7","labels_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/milestones/7/labels","id":2472679,"number":7,"title":"v3.0.0-rc2","description":"","creator":{"login":"RobDolinMS","id":8301581,"avatar_url":"https://avatars2.githubusercontent.com/u/8301581?v=3","gravatar_id":"","url":"https://api.github.com/users/RobDolinMS","html_url":"https://github.com/RobDolinMS","followers_url":"https://api.github.com/users/RobDolinMS/followers","following_url":"https://api.github.com/users/RobDolinMS/following{/other_user}","gists_url":"https://api.github.com/users/RobDolinMS/gists{/gist_id}","starred_url":"https://api.github.com/users/RobDolinMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobDolinMS/subscriptions","organizations_url":"https://api.github.com/users/RobDolinMS/orgs","repos_url":"https://api.github.com/users/RobDolinMS/repos","events_url":"https://api.github.com/users/RobDolinMS/events{/privacy}","received_events_url":"https://api.github.com/users/RobDolinMS/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":1,"state":"open","created_at":"2017-04-21T16:58:14Z","updated_at":"2017-05-08T22:50:25Z","due_on":"2017-05-19T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093/commits","review_comments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093/comments","review_comment_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/1093/comments","statuses_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/statuses/30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0","head":{"label":"OAI:issue-1085","ref":"issue-1085","sha":"30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0","user":{"login":"OAI","id":16343502,"avatar_url":"https://avatars0.githubusercontent.com/u/16343502?v=3","gravatar_id":"","url":"https://api.github.com/users/OAI","html_url":"https://github.com/OAI","followers_url":"https://api.github.com/users/OAI/followers","following_url":"https://api.github.com/users/OAI/following{/other_user}","gists_url":"https://api.github.com/users/OAI/gists{/gist_id}","starred_url":"https://api.github.com/users/OAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OAI/subscriptions","organizations_url":"https://api.github.com/users/OAI/orgs","repos_url":"https://api.github.com/users/OAI/repos","events_url":"https://api.github.com/users/OAI/events{/privacy}","received_events_url":"https://api.github.com/users/OAI/received_events","type":"Organization","site_admin":false},"repo":{"id":17372733,"name":"OpenAPI-Specification","full_name":"OAI/OpenAPI-Specification","owner":{"login":"OAI","id":16343502,"avatar_url":"https://avatars0.githubusercontent.com/u/16343502?v=3","gravatar_id":"","url":"https://api.github.com/users/OAI","html_url":"https://github.com/OAI","followers_url":"https://api.github.com/users/OAI/followers","following_url":"https://api.github.com/users/OAI/following{/other_user}","gists_url":"https://api.github.com/users/OAI/gists{/gist_id}","starred_url":"https://api.github.com/users/OAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OAI/subscriptions","organizations_url":"https://api.github.com/users/OAI/orgs","repos_url":"https://api.github.com/users/OAI/repos","events_url":"https://api.github.com/users/OAI/events{/privacy}","received_events_url":"https://api.github.com/users/OAI/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OAI/OpenAPI-Specification","description":"The OpenAPI Specification Repository","fork":false,"url":"https://api.github.com/repos/OAI/OpenAPI-Specification","forks_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/forks","keys_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/teams","hooks_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/hooks","issue_events_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/events{/number}","events_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/events","assignees_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/assignees{/user}","branches_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/branches{/branch}","tags_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/tags","blobs_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/refs{/sha}","trees_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/statuses/{sha}","languages_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/languages","stargazers_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/stargazers","contributors_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/contributors","subscribers_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/subscribers","subscription_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/subscription","commits_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/commits{/sha}","git_commits_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/commits{/sha}","comments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/comments{/number}","issue_comment_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/comments{/number}","contents_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/contents/{+path}","compare_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/merges","archive_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/downloads","issues_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues{/number}","pulls_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls{/number}","milestones_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/milestones{/number}","notifications_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/labels{/name}","releases_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/releases{/id}","deployments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/deployments","created_at":"2014-03-03T16:53:36Z","updated_at":"2017-05-10T14:54:20Z","pushed_at":"2017-05-10T04:20:03Z","git_url":"git://github.com/OAI/OpenAPI-Specification.git","ssh_url":"git@github.com:OAI/OpenAPI-Specification.git","clone_url":"https://github.com/OAI/OpenAPI-Specification.git","svn_url":"https://github.com/OAI/OpenAPI-Specification","homepage":"https://openapis.org","size":1809,"stargazers_count":6292,"watchers_count":6292,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1861,"mirror_url":null,"open_issues_count":218,"forks":1861,"open_issues":218,"watchers":6292,"default_branch":"master"}},"base":{"label":"OAI:OpenAPI.next","ref":"OpenAPI.next","sha":"43ca9925e3dd4f2afbcaa5974beacf0ddee4f835","user":{"login":"OAI","id":16343502,"avatar_url":"https://avatars0.githubusercontent.com/u/16343502?v=3","gravatar_id":"","url":"https://api.github.com/users/OAI","html_url":"https://github.com/OAI","followers_url":"https://api.github.com/users/OAI/followers","following_url":"https://api.github.com/users/OAI/following{/other_user}","gists_url":"https://api.github.com/users/OAI/gists{/gist_id}","starred_url":"https://api.github.com/users/OAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OAI/subscriptions","organizations_url":"https://api.github.com/users/OAI/orgs","repos_url":"https://api.github.com/users/OAI/repos","events_url":"https://api.github.com/users/OAI/events{/privacy}","received_events_url":"https://api.github.com/users/OAI/received_events","type":"Organization","site_admin":false},"repo":{"id":17372733,"name":"OpenAPI-Specification","full_name":"OAI/OpenAPI-Specification","owner":{"login":"OAI","id":16343502,"avatar_url":"https://avatars0.githubusercontent.com/u/16343502?v=3","gravatar_id":"","url":"https://api.github.com/users/OAI","html_url":"https://github.com/OAI","followers_url":"https://api.github.com/users/OAI/followers","following_url":"https://api.github.com/users/OAI/following{/other_user}","gists_url":"https://api.github.com/users/OAI/gists{/gist_id}","starred_url":"https://api.github.com/users/OAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OAI/subscriptions","organizations_url":"https://api.github.com/users/OAI/orgs","repos_url":"https://api.github.com/users/OAI/repos","events_url":"https://api.github.com/users/OAI/events{/privacy}","received_events_url":"https://api.github.com/users/OAI/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OAI/OpenAPI-Specification","description":"The OpenAPI Specification Repository","fork":false,"url":"https://api.github.com/repos/OAI/OpenAPI-Specification","forks_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/forks","keys_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/teams","hooks_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/hooks","issue_events_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/events{/number}","events_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/events","assignees_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/assignees{/user}","branches_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/branches{/branch}","tags_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/tags","blobs_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/refs{/sha}","trees_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/statuses/{sha}","languages_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/languages","stargazers_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/stargazers","contributors_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/contributors","subscribers_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/subscribers","subscription_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/subscription","commits_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/commits{/sha}","git_commits_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/git/commits{/sha}","comments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/comments{/number}","issue_comment_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/comments{/number}","contents_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/contents/{+path}","compare_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/merges","archive_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/downloads","issues_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues{/number}","pulls_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls{/number}","milestones_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/milestones{/number}","notifications_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/labels{/name}","releases_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/releases{/id}","deployments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/deployments","created_at":"2014-03-03T16:53:36Z","updated_at":"2017-05-10T14:54:20Z","pushed_at":"2017-05-10T04:20:03Z","git_url":"git://github.com/OAI/OpenAPI-Specification.git","ssh_url":"git@github.com:OAI/OpenAPI-Specification.git","clone_url":"https://github.com/OAI/OpenAPI-Specification.git","svn_url":"https://github.com/OAI/OpenAPI-Specification","homepage":"https://openapis.org","size":1809,"stargazers_count":6292,"watchers_count":6292,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1861,"mirror_url":null,"open_issues_count":218,"forks":1861,"open_issues":218,"watchers":6292,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093"},"html":{"href":"https://github.com/OAI/OpenAPI-Specification/pull/1093"},"issue":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/1093"},"comments":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/1093/comments"},"review_comments":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093/comments"},"review_comment":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/pulls/1093/commits"},"statuses":{"href":"https://api.github.com/repos/OAI/OpenAPI-Specification/statuses/30d3fa3abadb408ec9aa4113aa1c3bd1643a0ae0"}}}}
{"actor":{"display_login":"whitlockjc"}}