{"action":"created","issue":{"url":"https://api.github.com/repos/pandastrike/jsck/issues/99","labels_url":"https://api.github.com/repos/pandastrike/jsck/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/pandastrike/jsck/issues/99/comments","events_url":"https://api.github.com/repos/pandastrike/jsck/issues/99/events","html_url":"https://github.com/pandastrike/jsck/pull/99","id":115232031,"number":99,"title":"allow draft4 validator to provide specific errors when anyOf or oneOf fail","user":{"login":"cxreg","id":55474,"avatar_url":"https://avatars.githubusercontent.com/u/55474?v=3","gravatar_id":"","url":"https://api.github.com/users/cxreg","html_url":"https://github.com/cxreg","followers_url":"https://api.github.com/users/cxreg/followers","following_url":"https://api.github.com/users/cxreg/following{/other_user}","gists_url":"https://api.github.com/users/cxreg/gists{/gist_id}","starred_url":"https://api.github.com/users/cxreg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cxreg/subscriptions","organizations_url":"https://api.github.com/users/cxreg/orgs","repos_url":"https://api.github.com/users/cxreg/repos","events_url":"https://api.github.com/users/cxreg/events{/privacy}","received_events_url":"https://api.github.com/users/cxreg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-05T08:27:02Z","updated_at":"2015-11-10T03:40:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pandastrike/jsck/pulls/99","html_url":"https://github.com/pandastrike/jsck/pull/99","diff_url":"https://github.com/pandastrike/jsck/pull/99.diff","patch_url":"https://github.com/pandastrike/jsck/pull/99.patch"},"body":"Resolves #98 \r\n\r\nBy setting an option on the validator, we can allow JSCK to return more specific errors\r\n\r\nvar JSCK = require(\"jsck\").draft4;\r\nvar validator = new JSCK(schema).set_options({ \"closestMatch\": true });\r\n\r\nThe heuristic it uses is the most number of tests exercised in validating the document.  This is most likely to be the intended schema.\r\n\r\nSince the constructor is currently variadic, it seemed safest to provide the options-setting as an additional method.  This could be part of the constructor if the constructor's signature were to be modified."},"comment":{"url":"https://api.github.com/repos/pandastrike/jsck/issues/comments/155274731","html_url":"https://github.com/pandastrike/jsck/pull/99#issuecomment-155274731","issue_url":"https://api.github.com/repos/pandastrike/jsck/issues/99","id":155274731,"user":{"login":"automatthew","id":105,"avatar_url":"https://avatars.githubusercontent.com/u/105?v=3","gravatar_id":"","url":"https://api.github.com/users/automatthew","html_url":"https://github.com/automatthew","followers_url":"https://api.github.com/users/automatthew/followers","following_url":"https://api.github.com/users/automatthew/following{/other_user}","gists_url":"https://api.github.com/users/automatthew/gists{/gist_id}","starred_url":"https://api.github.com/users/automatthew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/automatthew/subscriptions","organizations_url":"https://api.github.com/users/automatthew/orgs","repos_url":"https://api.github.com/users/automatthew/repos","events_url":"https://api.github.com/users/automatthew/events{/privacy}","received_events_url":"https://api.github.com/users/automatthew/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T03:40:59Z","updated_at":"2015-11-10T03:40:59Z","body":"> I have API methods which have documented interfaces, but the schemas themselves are not public. The schema validation is used to enforce validity of the API call, and providing helpful messages back to the API user is desirable.\r\n\r\nThis is an excellent use case for driving such improvements.\r\n\r\nTomorrow, either I'll accept the PR, or I'll provide a way to make this behavior pluggable."}}