{"action":"created","issue":{"url":"https://api.github.com/repos/schematics/schematics/issues/206","labels_url":"https://api.github.com/repos/schematics/schematics/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/schematics/schematics/issues/206/comments","events_url":"https://api.github.com/repos/schematics/schematics/issues/206/events","html_url":"https://github.com/schematics/schematics/issues/206","id":26451987,"number":206,"title":"Whatever returned from model validation methods gets disregarded","user":{"login":"Gennady-Andreyev","id":1425831,"avatar_url":"https://avatars.githubusercontent.com/u/1425831?v=3","gravatar_id":"","url":"https://api.github.com/users/Gennady-Andreyev","html_url":"https://github.com/Gennady-Andreyev","followers_url":"https://api.github.com/users/Gennady-Andreyev/followers","following_url":"https://api.github.com/users/Gennady-Andreyev/following{/other_user}","gists_url":"https://api.github.com/users/Gennady-Andreyev/gists{/gist_id}","starred_url":"https://api.github.com/users/Gennady-Andreyev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gennady-Andreyev/subscriptions","organizations_url":"https://api.github.com/users/Gennady-Andreyev/orgs","repos_url":"https://api.github.com/users/Gennady-Andreyev/repos","events_url":"https://api.github.com/users/Gennady-Andreyev/events{/privacy}","received_events_url":"https://api.github.com/users/Gennady-Andreyev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-01-28T15:53:21Z","updated_at":"2015-10-14T19:37:10Z","closed_at":null,"body":"According to docs / examples, model-level validation methods return [\"clean\" values](http://schematics.readthedocs.org/en/latest/usage/validation.html#model-level-validation). But current implementation of \\_validate\\_model() [doesn't expect any return value](https://github.com/j2labs/schematics/blob/master/schematics/validate.py#L82), so whatever returned from model validation methods gets disregarded."},"comment":{"url":"https://api.github.com/repos/schematics/schematics/issues/comments/148171120","html_url":"https://github.com/schematics/schematics/issues/206#issuecomment-148171120","issue_url":"https://api.github.com/repos/schematics/schematics/issues/206","id":148171120,"user":{"login":"edc","id":426889,"avatar_url":"https://avatars.githubusercontent.com/u/426889?v=3","gravatar_id":"","url":"https://api.github.com/users/edc","html_url":"https://github.com/edc","followers_url":"https://api.github.com/users/edc/followers","following_url":"https://api.github.com/users/edc/following{/other_user}","gists_url":"https://api.github.com/users/edc/gists{/gist_id}","starred_url":"https://api.github.com/users/edc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edc/subscriptions","organizations_url":"https://api.github.com/users/edc/orgs","repos_url":"https://api.github.com/users/edc/repos","events_url":"https://api.github.com/users/edc/events{/privacy}","received_events_url":"https://api.github.com/users/edc/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T19:37:10Z","updated_at":"2015-10-14T19:37:10Z","body":"> According to docs / examples, model-level validation methods return \"clean\" values. \r\n\r\nThe docs do not explicitly say that, and the examples are not consistent about it.\r\n\r\n>  it could be that most people have been following the docs and returning something from their validator methods, but it's hard to tell.\r\n\r\nI think most users are *not* returning clean values from validators. So I am in favor of explicitly decorate the validator functions if they want to modify value. For validator *method* on the model class, they can already alter value by mutating the `data` argument, but returning the clean value is indeed a better approach.\r\n\r\nOn a related note: we need to correct the document to emphasize the validator methods work as class methods (i.e. it's clearer to name the first argument `cls`)."}}