{"action":"opened","issue":{"url":"https://api.github.com/repos/noirbizarre/flask-restplus/issues/101","labels_url":"https://api.github.com/repos/noirbizarre/flask-restplus/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/noirbizarre/flask-restplus/issues/101/comments","events_url":"https://api.github.com/repos/noirbizarre/flask-restplus/issues/101/events","html_url":"https://github.com/noirbizarre/flask-restplus/issues/101","id":119485276,"number":101,"title":"Descriptive payload validation error messages","user":{"login":"postrational","id":4430709,"avatar_url":"https://avatars.githubusercontent.com/u/4430709?v=3","gravatar_id":"","url":"https://api.github.com/users/postrational","html_url":"https://github.com/postrational","followers_url":"https://api.github.com/users/postrational/followers","following_url":"https://api.github.com/users/postrational/following{/other_user}","gists_url":"https://api.github.com/users/postrational/gists{/gist_id}","starred_url":"https://api.github.com/users/postrational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/postrational/subscriptions","organizations_url":"https://api.github.com/users/postrational/orgs","repos_url":"https://api.github.com/users/postrational/repos","events_url":"https://api.github.com/users/postrational/events{/privacy}","received_events_url":"https://api.github.com/users/postrational/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-30T12:46:18Z","updated_at":"2015-11-30T12:46:18Z","closed_at":null,"body":"Hi there, great work on Flask-Restful so far, keep the updates coming :)\r\n\r\nI wrote before about the possibility of using custom JSON schema objects for validation in #88\r\nIn 0.8.1 you added all the validation properties to fields of RestPlus models, so I can switch to using the native models for payload validation.\r\n\r\nThis is great, however in the process I noticed one problem. \r\n\r\nWhen I was using my hacked custom schema validation with Flask-RestPlus 0.8.0, then it produced HTTP 400 errors with a very descriptive JSON message such as: \r\n\r\n```json\r\n{\r\n  \"errors\": {\r\n    \"int_field\": \"'test' is not of type 'integer'\"\r\n  },\r\n  \"message\": \"Input payload validation failed\"\r\n}\r\n```\r\n\r\nor\r\n\r\n```json\r\n{\r\n  \"errors\": {\r\n    \"int_field\": \"1 is less than the minimum of 100\"\r\n  },\r\n  \"message\": \"Input payload validation failed\"\r\n}\r\n```\r\n\r\nor\r\n\r\n```json\r\n{\r\n  \"errors\": {\r\n    \"string_field\": \"'test' is too short\"\r\n  },\r\n  \"message\": \"Input payload validation failed\"\r\n}\r\n```\r\n\r\nCurently with 0.8.1 the same code produces the much less descriptive HTML:\r\n\r\n```html\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\r\n<title>400 Bad Request</title>\r\n<h1>Bad Request</h1>\r\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\r\n```\r\n\r\nI'm sure it would be possible to extract and return the validation errors in the form of JSON. \r\nThis can be then used by the API clients to display error messages to users.\r\n\r\nIt would be great if you could take a look at this."}}