{"id":22846028,"url":"https://github.com/termermc/vertx-web-validator-kotlin","last_synced_at":"2026-04-30T01:38:36.175Z","repository":{"id":57737843,"uuid":"349779543","full_name":"termermc/vertx-web-validator-kotlin","owner":"termermc","description":"A simple Kotlin library for null-safe Vert.x Web request validation / 简单与空类型安全的Vert.x Web请求验证程序库","archived":false,"fork":false,"pushed_at":"2022-08-08T03:10:56.000Z","size":61,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T05:29:33.176Z","etag":null,"topics":["kotlin","validation","vertx","vertx-web"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/termermc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-20T16:34:45.000Z","updated_at":"2023-12-12T21:41:00.000Z","dependencies_parsed_at":"2022-08-24T11:40:07.700Z","dependency_job_id":null,"html_url":"https://github.com/termermc/vertx-web-validator-kotlin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/termermc/vertx-web-validator-kotlin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fvertx-web-validator-kotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fvertx-web-validator-kotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fvertx-web-validator-kotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fvertx-web-validator-kotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/termermc","download_url":"https://codeload.github.com/termermc/vertx-web-validator-kotlin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fvertx-web-validator-kotlin/sbom","scorecard":{"id":874419,"data":{"date":"2025-08-11","repo":{"name":"github.com/termermc/vertx-web-validator-kotlin","commit":"69eebdb7d3edeb0322ceff7e83298099d8f221bb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T05:25:44.560Z","repository_id":57737843,"created_at":"2025-08-24T05:25:44.560Z","updated_at":"2025-08-24T05:25:44.560Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32451481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["kotlin","validation","vertx","vertx-web"],"created_at":"2024-12-13T03:19:56.342Z","updated_at":"2026-04-30T01:38:36.158Z","avatar_url":"https://github.com/termermc.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vertx-web-validator-kotlin\nA simple Kotlin library for null-safe Vert.x Web request validation\n\n# 中文\n你可以在[这里](README_zh.md)读中文指南。\n\n# Intro\nVert.x Web is a powerful framework for web development, but up until recently, it lacked a request validator.\nIn Vert.x 4, a scheme-based validator was released, but it is not nearly as simple as a fluent API for validation.\nThis library aims to provide a **simple**, **extensible**, **fluent**, and **null-safe** API for request validation, that is easy to integrate into *any* Vert.x Web project using Kotlin.\nIt aims to provide the simplicity of libraries like [express-validator](https://express-validator.github.io/docs/) in the NodeJS world.\n\n# Getting Started\nInclude the library using your favorite build tool. Here is a snippet for Gradle:\n\n```groovy\nimplementation 'net.termer.vertx.kotlin.validation:vertx-web-validator-kotlin:2.0.0'\n```\n\nHere is an example of what you might put inside a request handler that takes in information about a person:\n\n```kotlin\n// Request validation\nval v = RequestValidator()\n\t\t.param(\"name\", StringValidator()\n\t\t\t\t.noNewlinesOrControlChars()\n\t\t\t\t.maxLength(16))\n\t\t.param(\"age\", IntValidator()\n\t\t\t\t.min(13)\n\t\t\t\t.max(99))\n\t\t.optionalParam(\"email\", EmailValidator())\n\t\t.optionalParam(\"favoriteFood\", StringValidator()\n\t\t\t\t.minLength(3)\n\t\t\t\t.maxLength(16), \"unspecified\")\n\nif(v.validate(routingContext)) {\n\t// Collect parsed parameters\n\tval name = v.parsedParam(\"name\") as String // A non-nullable string, since we know for sure that \"name\" is present\n\tval age = v.parsedParam(\"age\") as Int // A non-nullable int, since we know for sure that \"age\" is an integer, and is present\n\tval email = v.parsedParam(\"email\") as String? // A nullable string, since we're not certain whether email was provided\n\tval favoriteFood = v.parsedParam(\"favoriteFood\") as String // A non-nullable string, since it is present, or a default value was used\n\n\t// Send response\n\tval res = routingContext.response()\n\n\tres.send(\"Your name is $name\\n\")\n\tres.send(\"Your age is $age\\n\")\n\tif(email != null)\n\t\tres.send(\"Your email is $email\\n\")\n\tres.send(\"Your favorite food is $favoriteFood\")\n\n\tres.end()\n} else {\n\troutingContext.response().end(\"${v.validationErrorParam}: ${v.validationErrorText}\")\n}\n```\n\nIt's very simple and does not require any special routing. It is safe to use in normal routes and middleware.\n\n# Creating Your Own Validators\n\nThere are many built-in validators that handle numbers, strings, emails, dates, and JSON, but you are also free to create your own validators for your own specific use-cases.\nThis is trivial to do, because all validators implement the ParamValidator interface, which at its most basic level validates a string and sends a status back, optionally parsing the provided string into another type of value.\n\nHere is an example of a validator that makes sure a string ends with and starts with an uppercase letter:\n\n```kotlin\nclass UppercaseStartAndEndValidator: ParamValidator {\n\toverride fun validate(param: ParamValidator.Param): ParamValidator.ValidatorResponse {\n\t\tval str = param.value\n\n\t\t// Make sure string is not blank\n\t\treturn if(str.isBlank()) {\n\t\t\tParamValidator.ValidatorResponse(\"BLANK_STRING\", \"The provided string is blank\")\n\t\t} else {\n\t\t\t// Make sure first and last character are both uppercase\n\t\t\tval first = str[0]\n\t\t\tval last = str[str.length - 1]\n\n\t\t\tif(first.isUpperCase() \u0026\u0026 last.isUpperCase()) {\n\t\t\t\t// Return the string as-is\n\t\t\t\tParamValidator.ValidatorResponse(str)\n\t\t\t} else {\n\t\t\t\tParamValidator.ValidatorResponse(\"START_AND_END_NOT_UPPERCASE\", \"The provided string's first and last characters are not uppercase\")\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nNow you can use this validator like any other.\n\nHere is an example of a validator that parses a comma-separated list into an array:\n\n```kotlin\nclass CommaSeparatedArrayValidator: ParamValidator {\n\toverride fun validate(param: ParamValidator.Param): ParamValidator.ValidatorResponse {\n\t\tval str = param.value\n\n\t\t// Return an empty array if blank\n\t\treturn if(str.isBlank()) {\n\t\t\tParamValidator.ValidatorResponse(arrayOf\u003cString\u003e())\n\t\t} else {\n\t\t\t// Split the string by comma (with regex to strip whitespace)\n\t\t\tval split = str.split(Regex(\"[\\\\W]*,[\\\\W]*\"))\n            \n            // Return array of strings\n            ParamValidator.ValidatorResponse(split)\n\t\t}\n\t}\n}\n```\n\nNow when you get the parsed value of this parameter, you will get an array of strings.\n\n# Documentation\nThe KDoc is available [here](https://termer.net/kdoc/vertx-web-validator-kotlin/2.0.0/index.html).\nThe javadoc is available [here](https://termer.net/javadoc/vertx-web-validator-kotlin/2.0.0/index.html) and on Maven Central.\n\nDocumentation can be rendered using the following commands: `gradlew kdoc`, `gradlew javadoc`\n\n# License\nThis project is licensed under the MIT license, so it is freely usable in any project.\n\n# Contact the author\nMy contact details are [here](https://termer.net/who).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fvertx-web-validator-kotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftermermc%2Fvertx-web-validator-kotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fvertx-web-validator-kotlin/lists"}