{"id":19807626,"url":"https://github.com/notninja/verifier","last_synced_at":"2026-01-11T16:59:50.477Z","repository":{"id":57736213,"uuid":"70599651","full_name":"NotNinja/verifier","owner":"NotNinja","description":"Java library for validation","archived":false,"fork":false,"pushed_at":"2017-10-03T09:37:09.000Z","size":806,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T06:28:39.715Z","etag":null,"topics":["java","validation","verification"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NotNinja.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-11T14:04:45.000Z","updated_at":"2017-10-02T21:57:48.000Z","dependencies_parsed_at":"2022-08-24T01:10:47.254Z","dependency_job_id":null,"html_url":"https://github.com/NotNinja/verifier","commit_stats":null,"previous_names":["skelp/verifier"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotNinja%2Fverifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotNinja%2Fverifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotNinja%2Fverifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotNinja%2Fverifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NotNinja","download_url":"https://codeload.github.com/NotNinja/verifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241150645,"owners_count":19918353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","validation","verification"],"created_at":"2024-11-12T09:11:28.414Z","updated_at":"2026-01-11T16:59:50.470Z","avatar_url":"https://github.com/NotNinja.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Verifier\n\n[Verifier](https://github.com/NotNinja/verifier) is a Java library for validation which concentrates on providing a\nsimple API with useful (and readable!) error messages, all while being highly configurable so that it's useful in your\napplication code.\n\n[![Build](https://img.shields.io/travis/NotNinja/verifier/develop.svg)](https://travis-ci.org/NotNinja/verifier)\n[![Coverage](https://img.shields.io/codecov/c/github/NotNinja/verifier/develop.svg)](https://codecov.io/gh/NotNinja/verifier)\n[![Translations](https://d322cqt584bo4o.cloudfront.net/verifier/localized.svg)](https://crowdin.com/project/verifier)\n[![JavaDoc](https://www.javadoc.io/badge/org.notninja/verifier.svg)](https://www.javadoc.io/doc/org.notninja/verifier)\n[![License](https://img.shields.io/github/license/NotNinja/verifier.svg)](https://github.com/NotNinja/verifier/blob/master/LICENSE.md)\n[![Maven Central](https://img.shields.io/maven-central/v/org.notninja/verifier.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.notninja%22%20AND%20a%3A%22verifier%22)\n\n* [Install](#install)\n* [API](#api)\n* [Bugs](#bugs)\n* [Contributors](#contributors)\n* [License](#license)\n\n## Install\n\nTo install Verifier, simply add it as a dependency to your project:\n\n**Maven:**\n``` xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.notninja\u003c/groupId\u003e\n    \u003cartifactId\u003everifier\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**Gradle:**\n``` groovy\ncompile 'org.notninja:verifier:0.3.0'\n```\n\nThat's it! You'll need to have Java 8 or above though.\n\n## API\n\nVerifier offers validation methods for a lot of standard Java data types:\n\n``` java\npackage com.example.form;\n\nimport org.notninja.verifier.Verifier;\n\npublic class LoginForm implements Form {\n\n    UserService userService;\n\n    @Override\n    public void handle(Map\u003cString, String\u003e data) {\n        Verifier.verify(data)\n            .containAllKeys(\"username\", \"password\");\n            .and(data.get(\"username\"), \"username\")\n                .not().blank();\n            .and(data.get(\"password\"), \"password\")\n                .not().empty()\n                .alphanumeric();\n\n        userService.login(data);\n    }\n}\n```\n\nHowever, you can also provide implementations of `CustomVerifier` to support more specific use cases instead of just\ndata types.\n\n``` java\npackage com.example.form;\n\nimport com.example.verifier.PasswordVerifier;\n\nimport org.notninja.verifier.Verifier;\n\npublic class RegistrationForm implements Form {\n\n    UserService userService;\n\n    @Override\n    public void handle(Map\u003cString, String\u003e data) {\n        Verifier.verify(data)\n            .containAllKeys(\"username\", \"password\");\n            .and(data.get(\"username\"), \"username\")\n                .not().blank()\n                .that((value) -\u003e userService.isAvailable(value));\n            .and(data.get(\"password\"), \"password\", PasswordVerifier.class)\n                .not().nulled()\n                .strong();\n\n        userService.register(data);\n    }\n}\n```\n\nThe best way to learn about the API is to simply use it and explore. It's designed to be very natural and simple. Each\nverification method is documented with examples to help explain exactly what's being verified.\n\nHere's a list of the data types supported by Verifier already:\n\n* Array\n* BigDecimal\n* BigInteger\n* Boolean\n* Byte\n* Calendar\n* Character\n* Class\n* Collection\n* Comparable\n* Date\n* Double\n* Float\n* Integer\n* Locale\n* Long\n* Map\n* Object\n* Short\n* String\n* Throwable\n\nIf a data type is missing that you'd like to see supported by Verifier, please take a look at the\n[Contributors](#contributors) section below.\n\n## Bugs\n\nIf you have any problems with Verifier or would like to see changes currently in development you can do so\n[here](https://github.com/NotNinja/verifier/issues).\n\n## Contributors\n\nIf you want to contribute, you're a legend! Information on how you can do so can be found in\n[CONTRIBUTING.md](https://github.com/NotNinja/verifier/blob/master/CONTRIBUTING.md). We want your suggestions and pull\nrequests!\n\nA list of Verifier contributors can be found in[AUTHORS.md](https://github.com/NotNinja/verifier/blob/master/AUTHORS.md).\n\n## License\n\nSee [LICENSE.md](https://github.com/NotNinja/verifier/raw/master/LICENSE.md) for more information on our MIT license.\n\n[![Copyright !ninja](https://cdn.rawgit.com/NotNinja/branding/master/assets/copyright/base/not-ninja-copyright-186x25.png)](https://not.ninja)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotninja%2Fverifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotninja%2Fverifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotninja%2Fverifier/lists"}