{"action":"opened","issue":{"url":"https://api.github.com/repos/Prismatic/schema/issues/268","labels_url":"https://api.github.com/repos/Prismatic/schema/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/Prismatic/schema/issues/268/comments","events_url":"https://api.github.com/repos/Prismatic/schema/issues/268/events","html_url":"https://github.com/Prismatic/schema/issues/268","id":105223104,"number":268,"title":"(RequiredKey. :foo) doesn't validate against :foo","user":{"login":"casperc","id":539481,"avatar_url":"https://avatars.githubusercontent.com/u/539481?v=3","gravatar_id":"","url":"https://api.github.com/users/casperc","html_url":"https://github.com/casperc","followers_url":"https://api.github.com/users/casperc/followers","following_url":"https://api.github.com/users/casperc/following{/other_user}","gists_url":"https://api.github.com/users/casperc/gists{/gist_id}","starred_url":"https://api.github.com/users/casperc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/casperc/subscriptions","organizations_url":"https://api.github.com/users/casperc/orgs","repos_url":"https://api.github.com/users/casperc/repos","events_url":"https://api.github.com/users/casperc/events{/privacy}","received_events_url":"https://api.github.com/users/casperc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-07T14:14:12Z","updated_at":"2015-09-07T14:14:12Z","closed_at":null,"body":"Given the following schema:\r\n\r\n    {(s/RequiredKey. :foo) s/Str :bar s/Keyword}\r\n\r\nAnd then check the schema\r\n\r\n    (s/check (make-keys-optional asdf) {:foo \"asdf\" :bar :foobar})\r\n    => {:foo disallowed-key}\r\n\r\nThe expected behaviour would be to treat it the same as the schema: {:foo s/Str :bar s/Keyword}\r\n\r\nAs for why I think this is important: I want to be able to crawl and modify the schema, to make a less strict validation, where all keys that are not marked as explicitly required will be marked as optional. This gist implements it the idea (is still WIP, so doesn't cover all cases): https://gist.github.com/casperc/250fa30d7ac96965d177#file-schema-optional-keys-cljs\r\n\r\nThis would give the following behaviour for that schema:\r\n  - fail if given a key not in the schema (as normal)\r\n  - fail if given a wrong type (as normal)\r\n  - pass if the validator is given a map with only the subset of defined keys in the schema.\r\n\r\nCurrently, I can't mark keys as explicitly required (required-key returns the key if given a keyword). I would be fine with doing this with `(RequiredKey. :foo)` instead of the helper function required-key to avoid breaking existing behaviour."}}