{"action":"created","issue":{"url":"https://api.github.com/repos/Julian/jsonschema/issues/296","repository_url":"https://api.github.com/repos/Julian/jsonschema","labels_url":"https://api.github.com/repos/Julian/jsonschema/issues/296/labels{/name}","comments_url":"https://api.github.com/repos/Julian/jsonschema/issues/296/comments","events_url":"https://api.github.com/repos/Julian/jsonschema/issues/296/events","html_url":"https://github.com/Julian/jsonschema/issues/296","id":178965578,"number":296,"title":"oneOf not looking through all items","user":{"login":"rachiebytes","id":5759165,"avatar_url":"https://avatars.githubusercontent.com/u/5759165?v=3","gravatar_id":"","url":"https://api.github.com/users/rachiebytes","html_url":"https://github.com/rachiebytes","followers_url":"https://api.github.com/users/rachiebytes/followers","following_url":"https://api.github.com/users/rachiebytes/following{/other_user}","gists_url":"https://api.github.com/users/rachiebytes/gists{/gist_id}","starred_url":"https://api.github.com/users/rachiebytes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rachiebytes/subscriptions","organizations_url":"https://api.github.com/users/rachiebytes/orgs","repos_url":"https://api.github.com/users/rachiebytes/repos","events_url":"https://api.github.com/users/rachiebytes/events{/privacy}","received_events_url":"https://api.github.com/users/rachiebytes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-23T20:23:06Z","updated_at":"2016-09-23T20:29:54Z","closed_at":"2016-09-23T20:29:54Z","body":"I have a schema:\r\n\r\n```javascript\r\n{\r\n  \"title\": \"Person\",\r\n  \"description\": \"Describes a person\",\r\n  \"type\": \"object\",\r\n  \"properties\": {\r\n    \"pid\": {\r\n      \"type\": \"string\"\r\n    },\r\n    \"events\": {\r\n      \"type\": \"array\",\r\n      \"items\": {\r\n        \"oneOf\": [\r\n          {\r\n            \"$ref\": \"#/definitions/citizenship\"\r\n          },\r\n          {\r\n            \"$ref\": \"#/definitions/dob\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  },\r\n  \"additionalProperties\": false,\r\n  \"required\": [\r\n    \"pid\",\r\n    \"events\"\r\n  ],\r\n  \"definitions\": {\r\n    \"dob\": {\r\n      \"properties\": {\r\n        \"type\": {\r\n          \"enum\": [\r\n            \"Birth\"\r\n          ]\r\n        },\r\n        \"event_date\": {\r\n          \"type\": \"string\",\r\n          \"format\": \"date-time\"\r\n        }\r\n      },\r\n      \"additionalProperties\": false,\r\n      \"required\": [\r\n        \"type\"\r\n      ]\r\n    },\r\n    \"citizenship\": {\r\n      \"properties\": {\r\n        \"type\": {\r\n          \"enum\": [\r\n            \"Citizenship\"\r\n          ]\r\n        },\r\n        \"ongoing\": {\r\n          \"type\": \"boolean\"\r\n        }\r\n      },\r\n      \"additionalProperties\": false,\r\n      \"required\": [\r\n        \"type\"\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nI have an instance of the schema:\r\n\r\n``` javascript\r\n{\r\n    \"pid\": \"Person0\", \r\n    \"events\": [\r\n        {\"type\": \"Birth\"}\r\n    ]\r\n}\r\n```\r\n\r\nIt fails validation with this error message: \r\n> jsonschema.exceptions.ValidationError: {'type': 'Birth'} is not valid under any of the given schemas\r\n\r\n\r\nHowever, it validates with this instance:\r\n``` javascript\r\n{\r\n    \"pid\": \"Person0\", \r\n    \"events\": [\r\n        {\"type\": \"Citizenship\"}\r\n    ]\r\n}\r\n```\r\n\r\n\r\nIt seems as if it is doing a linear search. If that type (whether is be Birth or Citizenship) is not found in the first item of the array then it fails.\r\n\r\nIs this suppose to be the behavior? If so, why?"},"comment":{"url":"https://api.github.com/repos/Julian/jsonschema/issues/comments/249294690","html_url":"https://github.com/Julian/jsonschema/issues/296#issuecomment-249294690","issue_url":"https://api.github.com/repos/Julian/jsonschema/issues/296","id":249294690,"user":{"login":"rachiebytes","id":5759165,"avatar_url":"https://avatars.githubusercontent.com/u/5759165?v=3","gravatar_id":"","url":"https://api.github.com/users/rachiebytes","html_url":"https://github.com/rachiebytes","followers_url":"https://api.github.com/users/rachiebytes/followers","following_url":"https://api.github.com/users/rachiebytes/following{/other_user}","gists_url":"https://api.github.com/users/rachiebytes/gists{/gist_id}","starred_url":"https://api.github.com/users/rachiebytes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rachiebytes/subscriptions","organizations_url":"https://api.github.com/users/rachiebytes/orgs","repos_url":"https://api.github.com/users/rachiebytes/repos","events_url":"https://api.github.com/users/rachiebytes/events{/privacy}","received_events_url":"https://api.github.com/users/rachiebytes/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T20:29:54Z","updated_at":"2016-09-23T20:29:54Z","body":"Ah, figured it out. Closing."}}
{"actor":{"display_login":"rachiebytes"}}