{"action":"created","comment":{"url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/comments/31870405","id":31870405,"diff_hunk":"@@ -0,0 +1,254 @@\n+.. _man-validation:\n+\n+#####################\n+Dropwizard Validation\n+#####################\n+\n+.. highlight:: text\n+\n+.. rubric:: Dropwizard comes with a host of validation tools out of the box to allow endpoints to return meaningful error messages when constraints are violated. Hibernate_ is packaged with Dropwizard, so what can be done in Hibernate, can be done with Dropwizard.\n+\n+.. _Hibernate: http://hibernate.org/validator/\n+\n+.. _man-validation-validations:\n+\n+Validations\n+===========\n+\n+Almost anything can be validated on resource endpoints. To give a quick example, the following\n+endpoint doesn't allow a null or empty ``name`` query parameter.\n+\n+.. code-block:: java\n+\n+    @GET\n+    public String find(@QueryParam(\"name\") @NotEmpty String arg) {\n+        // ...\n+    }\n+\n+If a client sends an empty or nonexistant name query param, Dropwizard will respond with a 400 error","path":"docs/source/manual/validation.rst","position":28,"original_position":28,"commit_id":"195e5ec7eaf09eccccfd78bc5e3698c844322e6a","original_commit_id":"195e5ec7eaf09eccccfd78bc5e3698c844322e6a","user":{"login":"arteam","id":1717632,"avatar_url":"https://avatars.githubusercontent.com/u/1717632?v=3","gravatar_id":"","url":"https://api.github.com/users/arteam","html_url":"https://github.com/arteam","followers_url":"https://api.github.com/users/arteam/followers","following_url":"https://api.github.com/users/arteam/following{/other_user}","gists_url":"https://api.github.com/users/arteam/gists{/gist_id}","starred_url":"https://api.github.com/users/arteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arteam/subscriptions","organizations_url":"https://api.github.com/users/arteam/orgs","repos_url":"https://api.github.com/users/arteam/repos","events_url":"https://api.github.com/users/arteam/events{/privacy}","received_events_url":"https://api.github.com/users/arteam/received_events","type":"User","site_admin":false},"body":"Maybe we could change 400 to  ``400 Bad Request``? I think, it's important to highlight it. ","created_at":"2015-06-06T18:39:57Z","updated_at":"2015-06-06T18:39:57Z","html_url":"https://github.com/dropwizard/dropwizard/pull/1091#discussion_r31870405","pull_request_url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091","_links":{"self":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/comments/31870405"},"html":{"href":"https://github.com/dropwizard/dropwizard/pull/1091#discussion_r31870405"},"pull_request":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091"}}},"pull_request":{"url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091","id":36773432,"html_url":"https://github.com/dropwizard/dropwizard/pull/1091","diff_url":"https://github.com/dropwizard/dropwizard/pull/1091.diff","patch_url":"https://github.com/dropwizard/dropwizard/pull/1091.patch","issue_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1091","number":1091,"state":"open","locked":false,"title":"Update Validation Documentation","user":{"login":"nickbabcock","id":2106129,"avatar_url":"https://avatars.githubusercontent.com/u/2106129?v=3","gravatar_id":"","url":"https://api.github.com/users/nickbabcock","html_url":"https://github.com/nickbabcock","followers_url":"https://api.github.com/users/nickbabcock/followers","following_url":"https://api.github.com/users/nickbabcock/following{/other_user}","gists_url":"https://api.github.com/users/nickbabcock/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbabcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbabcock/subscriptions","organizations_url":"https://api.github.com/users/nickbabcock/orgs","repos_url":"https://api.github.com/users/nickbabcock/repos","events_url":"https://api.github.com/users/nickbabcock/events{/privacy}","received_events_url":"https://api.github.com/users/nickbabcock/received_events","type":"User","site_admin":false},"body":"A hefty chunk of documentation on validation that covers previously undocumented features and updates others. I made it into it's own page due to its length. If this is not desired (due to potentially broken links to the documentation), I can merge it back\r\n\r\n**The documentation is currently not accurate (so it may not be a good idea to merge just yet)**: as\r\n\r\n```java\r\n@PUT\r\n@Valid\r\npublic Person replace(@Valid Person person) {\r\n    // Oops, we got a bug, a person can't have a null name\r\n    return new Person(null);\r\n}\r\n```\r\n\r\nwill return a `200 OK` and not `500 Internal Server Error`. \r\n\r\nLet me know if there are any corrections/suggestions.","created_at":"2015-06-02T20:59:24Z","updated_at":"2015-06-06T18:39:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c32b638a80ca6bdef8e37e035e7e139ad94ac2b","assignee":null,"milestone":{"url":"https://api.github.com/repos/dropwizard/dropwizard/milestones/8","html_url":"https://github.com/dropwizard/dropwizard/milestones/0.9.0","labels_url":"https://api.github.com/repos/dropwizard/dropwizard/milestones/8/labels","id":1039133,"number":8,"title":"0.9.0","description":"","creator":{"login":"jplock","id":49093,"avatar_url":"https://avatars.githubusercontent.com/u/49093?v=3","gravatar_id":"","url":"https://api.github.com/users/jplock","html_url":"https://github.com/jplock","followers_url":"https://api.github.com/users/jplock/followers","following_url":"https://api.github.com/users/jplock/following{/other_user}","gists_url":"https://api.github.com/users/jplock/gists{/gist_id}","starred_url":"https://api.github.com/users/jplock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jplock/subscriptions","organizations_url":"https://api.github.com/users/jplock/orgs","repos_url":"https://api.github.com/users/jplock/repos","events_url":"https://api.github.com/users/jplock/events{/privacy}","received_events_url":"https://api.github.com/users/jplock/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":75,"state":"open","created_at":"2015-03-25T21:01:11Z","updated_at":"2015-06-05T13:34:23Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091/commits","review_comments_url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091/comments","review_comment_url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1091/comments","statuses_url":"https://api.github.com/repos/dropwizard/dropwizard/statuses/195e5ec7eaf09eccccfd78bc5e3698c844322e6a","head":{"label":"nickbabcock:validation-docs","ref":"validation-docs","sha":"195e5ec7eaf09eccccfd78bc5e3698c844322e6a","user":{"login":"nickbabcock","id":2106129,"avatar_url":"https://avatars.githubusercontent.com/u/2106129?v=3","gravatar_id":"","url":"https://api.github.com/users/nickbabcock","html_url":"https://github.com/nickbabcock","followers_url":"https://api.github.com/users/nickbabcock/followers","following_url":"https://api.github.com/users/nickbabcock/following{/other_user}","gists_url":"https://api.github.com/users/nickbabcock/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbabcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbabcock/subscriptions","organizations_url":"https://api.github.com/users/nickbabcock/orgs","repos_url":"https://api.github.com/users/nickbabcock/repos","events_url":"https://api.github.com/users/nickbabcock/events{/privacy}","received_events_url":"https://api.github.com/users/nickbabcock/received_events","type":"User","site_admin":false},"repo":{"id":18115354,"name":"dropwizard","full_name":"nickbabcock/dropwizard","owner":{"login":"nickbabcock","id":2106129,"avatar_url":"https://avatars.githubusercontent.com/u/2106129?v=3","gravatar_id":"","url":"https://api.github.com/users/nickbabcock","html_url":"https://github.com/nickbabcock","followers_url":"https://api.github.com/users/nickbabcock/followers","following_url":"https://api.github.com/users/nickbabcock/following{/other_user}","gists_url":"https://api.github.com/users/nickbabcock/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbabcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbabcock/subscriptions","organizations_url":"https://api.github.com/users/nickbabcock/orgs","repos_url":"https://api.github.com/users/nickbabcock/repos","events_url":"https://api.github.com/users/nickbabcock/events{/privacy}","received_events_url":"https://api.github.com/users/nickbabcock/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nickbabcock/dropwizard","description":"A damn simple library for building production-ready RESTful web services.","fork":true,"url":"https://api.github.com/repos/nickbabcock/dropwizard","forks_url":"https://api.github.com/repos/nickbabcock/dropwizard/forks","keys_url":"https://api.github.com/repos/nickbabcock/dropwizard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nickbabcock/dropwizard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nickbabcock/dropwizard/teams","hooks_url":"https://api.github.com/repos/nickbabcock/dropwizard/hooks","issue_events_url":"https://api.github.com/repos/nickbabcock/dropwizard/issues/events{/number}","events_url":"https://api.github.com/repos/nickbabcock/dropwizard/events","assignees_url":"https://api.github.com/repos/nickbabcock/dropwizard/assignees{/user}","branches_url":"https://api.github.com/repos/nickbabcock/dropwizard/branches{/branch}","tags_url":"https://api.github.com/repos/nickbabcock/dropwizard/tags","blobs_url":"https://api.github.com/repos/nickbabcock/dropwizard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nickbabcock/dropwizard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nickbabcock/dropwizard/git/refs{/sha}","trees_url":"https://api.github.com/repos/nickbabcock/dropwizard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nickbabcock/dropwizard/statuses/{sha}","languages_url":"https://api.github.com/repos/nickbabcock/dropwizard/languages","stargazers_url":"https://api.github.com/repos/nickbabcock/dropwizard/stargazers","contributors_url":"https://api.github.com/repos/nickbabcock/dropwizard/contributors","subscribers_url":"https://api.github.com/repos/nickbabcock/dropwizard/subscribers","subscription_url":"https://api.github.com/repos/nickbabcock/dropwizard/subscription","commits_url":"https://api.github.com/repos/nickbabcock/dropwizard/commits{/sha}","git_commits_url":"https://api.github.com/repos/nickbabcock/dropwizard/git/commits{/sha}","comments_url":"https://api.github.com/repos/nickbabcock/dropwizard/comments{/number}","issue_comment_url":"https://api.github.com/repos/nickbabcock/dropwizard/issues/comments{/number}","contents_url":"https://api.github.com/repos/nickbabcock/dropwizard/contents/{+path}","compare_url":"https://api.github.com/repos/nickbabcock/dropwizard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nickbabcock/dropwizard/merges","archive_url":"https://api.github.com/repos/nickbabcock/dropwizard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nickbabcock/dropwizard/downloads","issues_url":"https://api.github.com/repos/nickbabcock/dropwizard/issues{/number}","pulls_url":"https://api.github.com/repos/nickbabcock/dropwizard/pulls{/number}","milestones_url":"https://api.github.com/repos/nickbabcock/dropwizard/milestones{/number}","notifications_url":"https://api.github.com/repos/nickbabcock/dropwizard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nickbabcock/dropwizard/labels{/name}","releases_url":"https://api.github.com/repos/nickbabcock/dropwizard/releases{/id}","created_at":"2014-03-25T20:24:18Z","updated_at":"2015-04-17T18:15:07Z","pushed_at":"2015-06-06T15:51:41Z","git_url":"git://github.com/nickbabcock/dropwizard.git","ssh_url":"git@github.com:nickbabcock/dropwizard.git","clone_url":"https://github.com/nickbabcock/dropwizard.git","svn_url":"https://github.com/nickbabcock/dropwizard","homepage":"http://www.dropwizard.io","size":6676,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dropwizard:master","ref":"master","sha":"db792a5e48e95801c3b468981ab06b534d618ae4","user":{"login":"dropwizard","id":5478557,"avatar_url":"https://avatars.githubusercontent.com/u/5478557?v=3","gravatar_id":"","url":"https://api.github.com/users/dropwizard","html_url":"https://github.com/dropwizard","followers_url":"https://api.github.com/users/dropwizard/followers","following_url":"https://api.github.com/users/dropwizard/following{/other_user}","gists_url":"https://api.github.com/users/dropwizard/gists{/gist_id}","starred_url":"https://api.github.com/users/dropwizard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropwizard/subscriptions","organizations_url":"https://api.github.com/users/dropwizard/orgs","repos_url":"https://api.github.com/users/dropwizard/repos","events_url":"https://api.github.com/users/dropwizard/events{/privacy}","received_events_url":"https://api.github.com/users/dropwizard/received_events","type":"Organization","site_admin":false},"repo":{"id":1272129,"name":"dropwizard","full_name":"dropwizard/dropwizard","owner":{"login":"dropwizard","id":5478557,"avatar_url":"https://avatars.githubusercontent.com/u/5478557?v=3","gravatar_id":"","url":"https://api.github.com/users/dropwizard","html_url":"https://github.com/dropwizard","followers_url":"https://api.github.com/users/dropwizard/followers","following_url":"https://api.github.com/users/dropwizard/following{/other_user}","gists_url":"https://api.github.com/users/dropwizard/gists{/gist_id}","starred_url":"https://api.github.com/users/dropwizard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropwizard/subscriptions","organizations_url":"https://api.github.com/users/dropwizard/orgs","repos_url":"https://api.github.com/users/dropwizard/repos","events_url":"https://api.github.com/users/dropwizard/events{/privacy}","received_events_url":"https://api.github.com/users/dropwizard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dropwizard/dropwizard","description":"A damn simple library for building production-ready RESTful web services.","fork":false,"url":"https://api.github.com/repos/dropwizard/dropwizard","forks_url":"https://api.github.com/repos/dropwizard/dropwizard/forks","keys_url":"https://api.github.com/repos/dropwizard/dropwizard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dropwizard/dropwizard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dropwizard/dropwizard/teams","hooks_url":"https://api.github.com/repos/dropwizard/dropwizard/hooks","issue_events_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/events{/number}","events_url":"https://api.github.com/repos/dropwizard/dropwizard/events","assignees_url":"https://api.github.com/repos/dropwizard/dropwizard/assignees{/user}","branches_url":"https://api.github.com/repos/dropwizard/dropwizard/branches{/branch}","tags_url":"https://api.github.com/repos/dropwizard/dropwizard/tags","blobs_url":"https://api.github.com/repos/dropwizard/dropwizard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dropwizard/dropwizard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dropwizard/dropwizard/git/refs{/sha}","trees_url":"https://api.github.com/repos/dropwizard/dropwizard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dropwizard/dropwizard/statuses/{sha}","languages_url":"https://api.github.com/repos/dropwizard/dropwizard/languages","stargazers_url":"https://api.github.com/repos/dropwizard/dropwizard/stargazers","contributors_url":"https://api.github.com/repos/dropwizard/dropwizard/contributors","subscribers_url":"https://api.github.com/repos/dropwizard/dropwizard/subscribers","subscription_url":"https://api.github.com/repos/dropwizard/dropwizard/subscription","commits_url":"https://api.github.com/repos/dropwizard/dropwizard/commits{/sha}","git_commits_url":"https://api.github.com/repos/dropwizard/dropwizard/git/commits{/sha}","comments_url":"https://api.github.com/repos/dropwizard/dropwizard/comments{/number}","issue_comment_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/comments{/number}","contents_url":"https://api.github.com/repos/dropwizard/dropwizard/contents/{+path}","compare_url":"https://api.github.com/repos/dropwizard/dropwizard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dropwizard/dropwizard/merges","archive_url":"https://api.github.com/repos/dropwizard/dropwizard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dropwizard/dropwizard/downloads","issues_url":"https://api.github.com/repos/dropwizard/dropwizard/issues{/number}","pulls_url":"https://api.github.com/repos/dropwizard/dropwizard/pulls{/number}","milestones_url":"https://api.github.com/repos/dropwizard/dropwizard/milestones{/number}","notifications_url":"https://api.github.com/repos/dropwizard/dropwizard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dropwizard/dropwizard/labels{/name}","releases_url":"https://api.github.com/repos/dropwizard/dropwizard/releases{/id}","created_at":"2011-01-19T19:52:29Z","updated_at":"2015-06-06T12:07:54Z","pushed_at":"2015-06-06T15:58:49Z","git_url":"git://github.com/dropwizard/dropwizard.git","ssh_url":"git@github.com:dropwizard/dropwizard.git","clone_url":"https://github.com/dropwizard/dropwizard.git","svn_url":"https://github.com/dropwizard/dropwizard","homepage":"http://www.dropwizard.io","size":31345,"stargazers_count":3355,"watchers_count":3355,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1388,"mirror_url":null,"open_issues_count":52,"forks":1388,"open_issues":52,"watchers":3355,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091"},"html":{"href":"https://github.com/dropwizard/dropwizard/pull/1091"},"issue":{"href":"https://api.github.com/repos/dropwizard/dropwizard/issues/1091"},"comments":{"href":"https://api.github.com/repos/dropwizard/dropwizard/issues/1091/comments"},"review_comments":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091/comments"},"review_comment":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1091/commits"},"statuses":{"href":"https://api.github.com/repos/dropwizard/dropwizard/statuses/195e5ec7eaf09eccccfd78bc5e3698c844322e6a"}}}}