{"action":"closed","issue":{"url":"https://api.github.com/repos/rightscale/attributor/issues/152","labels_url":"https://api.github.com/repos/rightscale/attributor/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/rightscale/attributor/issues/152/comments","events_url":"https://api.github.com/repos/rightscale/attributor/issues/152/events","html_url":"https://github.com/rightscale/attributor/issues/152","id":122657081,"number":152,"title":"Struct/Models do not validate entries using the `requires` DSL","user":{"login":"blanquer","id":33885,"avatar_url":"https://avatars.githubusercontent.com/u/33885?v=3","gravatar_id":"","url":"https://api.github.com/users/blanquer","html_url":"https://github.com/blanquer","followers_url":"https://api.github.com/users/blanquer/followers","following_url":"https://api.github.com/users/blanquer/following{/other_user}","gists_url":"https://api.github.com/users/blanquer/gists{/gist_id}","starred_url":"https://api.github.com/users/blanquer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blanquer/subscriptions","organizations_url":"https://api.github.com/users/blanquer/orgs","repos_url":"https://api.github.com/users/blanquer/repos","events_url":"https://api.github.com/users/blanquer/events{/privacy}","received_events_url":"https://api.github.com/users/blanquer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rightscale/attributor/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"blanquer","id":33885,"avatar_url":"https://avatars.githubusercontent.com/u/33885?v=3","gravatar_id":"","url":"https://api.github.com/users/blanquer","html_url":"https://github.com/blanquer","followers_url":"https://api.github.com/users/blanquer/followers","following_url":"https://api.github.com/users/blanquer/following{/other_user}","gists_url":"https://api.github.com/users/blanquer/gists{/gist_id}","starred_url":"https://api.github.com/users/blanquer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blanquer/subscriptions","organizations_url":"https://api.github.com/users/blanquer/orgs","repos_url":"https://api.github.com/users/blanquer/repos","events_url":"https://api.github.com/users/blanquer/events{/privacy}","received_events_url":"https://api.github.com/users/blanquer/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-12-17T04:05:17Z","updated_at":"2015-12-18T01:27:25Z","closed_at":"2015-12-18T01:27:25Z","body":"For example, a model like this will not generate any errors if validating an instance that does not have the `:name` set:\r\n\r\n```ruby\r\nclass Foo < Attributor::Model\r\n  attributes do\r\n    attribute :id, Integer\r\n    attribute :name, String\r\n    requires :name\r\n  end\r\nend\r\n```\r\n\r\nThe same type, derived from an attributor `Hash` would complain.\r\n\r\nThe problem is that `Model`s (and therefore `Struct`s) overload the `validate` function from `Hash`, and that function does not process any requirements done with the `requires` DSL.\r\n\r\n"}}