{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/2722","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/2722/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/2722/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/2722/events","html_url":"https://github.com/aspnet/Mvc/issues/2722","id":89851785,"number":2722,"title":"Expand `InputFormatterContext` or `IInputFormatter.ReadAsync()` to make errors explicit","user":{"login":"dougbu","id":6431421,"avatar_url":"https://avatars.githubusercontent.com/u/6431421?v=3","gravatar_id":"","url":"https://api.github.com/users/dougbu","html_url":"https://github.com/dougbu","followers_url":"https://api.github.com/users/dougbu/followers","following_url":"https://api.github.com/users/dougbu/following{/other_user}","gists_url":"https://api.github.com/users/dougbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbu/subscriptions","organizations_url":"https://api.github.com/users/dougbu/orgs","repos_url":"https://api.github.com/users/dougbu/repos","events_url":"https://api.github.com/users/dougbu/events{/privacy}","received_events_url":"https://api.github.com/users/dougbu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/Mvc/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/aspnet/Mvc/labels/Model%20Binding","name":"Model Binding","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/aspnet/Mvc/milestones/15","html_url":"https://github.com/aspnet/Mvc/milestones/6.0.0-beta6","labels_url":"https://api.github.com/repos/aspnet/Mvc/milestones/15/labels","id":1099269,"number":15,"title":"6.0.0-beta6","description":"","creator":{"login":"danroth27","id":1874516,"avatar_url":"https://avatars.githubusercontent.com/u/1874516?v=3","gravatar_id":"","url":"https://api.github.com/users/danroth27","html_url":"https://github.com/danroth27","followers_url":"https://api.github.com/users/danroth27/followers","following_url":"https://api.github.com/users/danroth27/following{/other_user}","gists_url":"https://api.github.com/users/danroth27/gists{/gist_id}","starred_url":"https://api.github.com/users/danroth27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danroth27/subscriptions","organizations_url":"https://api.github.com/users/danroth27/orgs","repos_url":"https://api.github.com/users/danroth27/repos","events_url":"https://api.github.com/users/danroth27/events{/privacy}","received_events_url":"https://api.github.com/users/danroth27/received_events","type":"User","site_admin":false},"open_issues":78,"closed_issues":30,"state":"open","created_at":"2015-05-06T21:43:30Z","updated_at":"2015-06-22T16:23:43Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-06-21T02:32:00Z","updated_at":"2015-06-22T20:16:43Z","closed_at":null,"body":"Need a clear way for input formatters to indicate errors -- without `throw`ing. Handling errors more clearly fixes a bug due to gaps in the current approach.\r\n\r\nAlso need more tests covering cases where the `JsonInputFormatter` adds `ModelState` errors and other input formatters `throw`.\r\n\r\nCurrently most `IInputFormatter` implementations `throw` when they encounter an error condition. However the `JsonInputFormatter` adds `ModelState` errors in many cases. As seen in c4fa402 and mentioned in a PR [comment](https://github.com/aspnet/Mvc/pull/2695#discussion_r32681923), the obvious way to check for errors (comparing `ModelState.ErrorCount` before and after) is insufficient. Further `await formatter.ReadAsync(...) == null` is incorrect because the input may be explicitly `null`."},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/114248494","html_url":"https://github.com/aspnet/Mvc/issues/2722#issuecomment-114248494","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/2722","id":114248494,"user":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars.githubusercontent.com/u/1430011?v=3","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T20:16:43Z","updated_at":"2015-06-22T20:16:43Z","body":"> Throwing due to input seems problematic - generally we should return a 400 level response (not a 500) if the request data is bad (ex. invalid JSON or XML).\r\n\r\nThis bug tracks plumbing needed to turn the response into a 400 (errors in modelstate). As @dougbu mentioned, right now errors aren't being reported correctly unless you throw."}}