{"action":"created","issue":{"url":"https://api.github.com/repos/playframework/playframework/issues/5097","labels_url":"https://api.github.com/repos/playframework/playframework/issues/5097/labels{/name}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/5097/comments","events_url":"https://api.github.com/repos/playframework/playframework/issues/5097/events","html_url":"https://github.com/playframework/playframework/pull/5097","id":106188127,"number":5097,"title":"enable field level validation errors when applying object-level const…","user":{"login":"NTCoding","id":692094,"avatar_url":"https://avatars.githubusercontent.com/u/692094?v=3","gravatar_id":"","url":"https://api.github.com/users/NTCoding","html_url":"https://github.com/NTCoding","followers_url":"https://api.github.com/users/NTCoding/followers","following_url":"https://api.github.com/users/NTCoding/following{/other_user}","gists_url":"https://api.github.com/users/NTCoding/gists{/gist_id}","starred_url":"https://api.github.com/users/NTCoding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NTCoding/subscriptions","organizations_url":"https://api.github.com/users/NTCoding/orgs","repos_url":"https://api.github.com/users/NTCoding/repos","events_url":"https://api.github.com/users/NTCoding/events{/privacy}","received_events_url":"https://api.github.com/users/NTCoding/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-12T22:23:51Z","updated_at":"2015-09-13T07:08:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/5097","html_url":"https://github.com/playframework/playframework/pull/5097","diff_url":"https://github.com/playframework/playframework/pull/5097.diff","patch_url":"https://github.com/playframework/playframework/pull/5097.patch"},"body":"When using the verifying function on mapping objects it is only possible to return a collection of validation errors. Validation errors do not let you specify which field the error should be applied to.\r\n\r\nThis is a problem when you want to compare multiple values on an object and apply the resulting to error to just one of them. You can see the test I've added as a basic example. The idea is that if field2 has the same value as field1 the resulting error should be associated with one of those fields.\r\n\r\nIn the system I am currently building we shoved the field name inside the error message using a custom format and unpacked after calling bind on the form. This commit is a far nicer solution that also makes it easy for other users of the play framework to achieve the same goal.\r\n\r\nI hope you like this feature and decide to merge it. If you do and would like me to add an example to the documentation, please just let me know. Likewise if you have any questions about the rationale or the implementation, I'll be more than happy to help.\r\n"},"comment":{"url":"https://api.github.com/repos/playframework/playframework/issues/comments/139848212","html_url":"https://github.com/playframework/playframework/pull/5097#issuecomment-139848212","issue_url":"https://api.github.com/repos/playframework/playframework/issues/5097","id":139848212,"user":{"login":"NTCoding","id":692094,"avatar_url":"https://avatars.githubusercontent.com/u/692094?v=3","gravatar_id":"","url":"https://api.github.com/users/NTCoding","html_url":"https://github.com/NTCoding","followers_url":"https://api.github.com/users/NTCoding/followers","following_url":"https://api.github.com/users/NTCoding/following{/other_user}","gists_url":"https://api.github.com/users/NTCoding/gists{/gist_id}","starred_url":"https://api.github.com/users/NTCoding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NTCoding/subscriptions","organizations_url":"https://api.github.com/users/NTCoding/orgs","repos_url":"https://api.github.com/users/NTCoding/repos","events_url":"https://api.github.com/users/NTCoding/events{/privacy}","received_events_url":"https://api.github.com/users/NTCoding/received_events","type":"User","site_admin":false},"created_at":"2015-09-13T07:08:01Z","updated_at":"2015-09-13T07:08:01Z","body":"Not sure why that test is failing? Is this possibly unrelated to my changes?\r\n\r\n[error] (Play-Akka-Http-Server-Experimental/*:scripted) Failed tests:\r\n[error] \takka-http / system-property"}}