{"action":"created","issue":{"url":"https://api.github.com/repos/zalando/problem-spring-web/issues/49","repository_url":"https://api.github.com/repos/zalando/problem-spring-web","labels_url":"https://api.github.com/repos/zalando/problem-spring-web/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/zalando/problem-spring-web/issues/49/comments","events_url":"https://api.github.com/repos/zalando/problem-spring-web/issues/49/events","html_url":"https://github.com/zalando/problem-spring-web/issues/49","id":158099375,"number":49,"title":"[Question] Validation but not 422","user":{"login":"kakawait","id":275609,"avatar_url":"https://avatars.githubusercontent.com/u/275609?v=3","gravatar_id":"","url":"https://api.github.com/users/kakawait","html_url":"https://github.com/kakawait","followers_url":"https://api.github.com/users/kakawait/followers","following_url":"https://api.github.com/users/kakawait/following{/other_user}","gists_url":"https://api.github.com/users/kakawait/gists{/gist_id}","starred_url":"https://api.github.com/users/kakawait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kakawait/subscriptions","organizations_url":"https://api.github.com/users/kakawait/orgs","repos_url":"https://api.github.com/users/kakawait/repos","events_url":"https://api.github.com/users/kakawait/events{/privacy}","received_events_url":"https://api.github.com/users/kakawait/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-02T09:41:51Z","updated_at":"2016-06-06T11:01:34Z","closed_at":null,"body":"In common case we used to validated entity from `POST`, `PUT`, etc.. Thus when validation exception is triggered the good way is to return `422 Unprocessable Entity` !\r\n\r\nHowever sometime we can validate query param like following API:\r\n\r\n```\r\n/api/feed?url=XXX\r\n```\r\n\r\nWhere `url` is mandatory param with following validation:\r\n\r\n1. Should not be empty\r\n2. Should be a valid URL\r\n\r\nFor 1. we can simply return a `MissingServletRequestParameterException` that is correctly manage by *problem-spring-web* but for 2. I don't think `422 Unprocessable Entity` is a correct status. Because url and query param is not part of request entity.\r\n\r\nI was thinking about returning `400` status but with validation problem body\r\n\r\n```\r\n{\r\n  \"violations\": [\r\n    {\r\n      \"field\": \"url\",\r\n      \"message\": \"must be a valid URL\"\r\n    }\r\n  ],\r\n  \"type\": \"<URI>\",\r\n  \"status\": 400,\r\n  \"title\": \"Constraint Violation\"\r\n}\r\n```\r\n\r\nDo you think is a good idea? If yes how can I reuse existing `ConstraintViolationProblem` (`final` class)"},"comment":{"url":"https://api.github.com/repos/zalando/problem-spring-web/issues/comments/223928541","html_url":"https://github.com/zalando/problem-spring-web/issues/49#issuecomment-223928541","issue_url":"https://api.github.com/repos/zalando/problem-spring-web/issues/49","id":223928541,"user":{"login":"whiskeysierra","id":429981,"avatar_url":"https://avatars.githubusercontent.com/u/429981?v=3","gravatar_id":"","url":"https://api.github.com/users/whiskeysierra","html_url":"https://github.com/whiskeysierra","followers_url":"https://api.github.com/users/whiskeysierra/followers","following_url":"https://api.github.com/users/whiskeysierra/following{/other_user}","gists_url":"https://api.github.com/users/whiskeysierra/gists{/gist_id}","starred_url":"https://api.github.com/users/whiskeysierra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whiskeysierra/subscriptions","organizations_url":"https://api.github.com/users/whiskeysierra/orgs","repos_url":"https://api.github.com/users/whiskeysierra/repos","events_url":"https://api.github.com/users/whiskeysierra/events{/privacy}","received_events_url":"https://api.github.com/users/whiskeysierra/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T11:01:34Z","updated_at":"2016-06-06T11:01:34Z","body":"Would it be sufficient for you to introduce a property in `ConstraintViolationProblem` that allows to customize the status? Or would you vote for changing this to 400 globally?"}}
{"actor":{"display_login":"whiskeysierra"}}