{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/1751","repository_url":"https://api.github.com/repos/elixir-ecto/ecto","labels_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/1751/labels{/name}","comments_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/1751/comments","events_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/1751/events","html_url":"https://github.com/elixir-ecto/ecto/issues/1751","id":184047897,"number":1751,"title":"Additional options for all Ecto.Changeset validation errors","user":{"login":"AndrewDryga","id":1877644,"avatar_url":"https://avatars.githubusercontent.com/u/1877644?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewDryga","html_url":"https://github.com/AndrewDryga","followers_url":"https://api.github.com/users/AndrewDryga/followers","following_url":"https://api.github.com/users/AndrewDryga/following{/other_user}","gists_url":"https://api.github.com/users/AndrewDryga/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewDryga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewDryga/subscriptions","organizations_url":"https://api.github.com/users/AndrewDryga/orgs","repos_url":"https://api.github.com/users/AndrewDryga/repos","events_url":"https://api.github.com/users/AndrewDryga/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewDryga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-19T19:06:52Z","updated_at":"2016-10-19T20:00:11Z","closed_at":null,"body":"Hi guys,\r\n\r\n[We](https://github.com/Nebo15/) love to provide our users very descriptive validation errors on Front-End of our projects, so our error structure [is complex](http://docs.apimanifest.apiary.io/#introduction/interacting-with-api/errors):\r\n```\r\n{\r\n  \"error\": {\r\n    \"type\": \"validation_failed\",\r\n    \"invalid\": [\r\n      {\r\n        \"entry_type\": \"json_data_proprty\",\r\n        \"entry\": \"#/product_type\",\r\n        \"rules\": [\r\n          {\r\n            \"rule\": \"string\",\r\n            \"params\": []\r\n          },\r\n          {\r\n            \"rule\": \"min:2\",\r\n            \"params\": [{\"min\": 2}]\r\n          }\r\n        ]\r\n      }\r\n    ],\r\n    \"message\": \"Validation failed. Return human-readable error message. You find all possible validation rules at https://docs.qbill.ly/#request-validators.\"\r\n  }\r\n}\r\n```\r\n\r\nAnd `Ecto.Changeset` doesn't provide sufficient data for such response structure, and setting `[message:..]` option for each changeset in each project is will mess everything (for example, you can forget to set it, and it's hard to refactor messages across all projects).\r\n\r\nOur core idea is to provide PR that will add additional data to options (validation function and all validation options), that will be accessible in `traverse_errors/1` function and it should not break backwards compatibility.\r\n\r\nIs it ok to work on this PR (would you like to see it?) or we should look for another way to solve our issue?"},"comment":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/comments/254923660","html_url":"https://github.com/elixir-ecto/ecto/issues/1751#issuecomment-254923660","issue_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/1751","id":254923660,"user":{"login":"AndrewDryga","id":1877644,"avatar_url":"https://avatars.githubusercontent.com/u/1877644?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewDryga","html_url":"https://github.com/AndrewDryga","followers_url":"https://api.github.com/users/AndrewDryga/followers","following_url":"https://api.github.com/users/AndrewDryga/following{/other_user}","gists_url":"https://api.github.com/users/AndrewDryga/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewDryga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewDryga/subscriptions","organizations_url":"https://api.github.com/users/AndrewDryga/orgs","repos_url":"https://api.github.com/users/AndrewDryga/repos","events_url":"https://api.github.com/users/AndrewDryga/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewDryga/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T20:00:11Z","updated_at":"2016-10-19T20:00:11Z","body":"That oversimplified example, I'm trying to make sure all possible validations can be turned in struct like that one. I guest I can we can create our own implementation or `traverse_errors` and collect all necessary information from `changeset.required` and  `changeset.validations`. Ill try and report  with code samples if it's not feasible."}}
{"actor":{"display_login":"AndrewDryga"}}