{"id":49084403,"url":"https://github.com/thekoushik/gateman","last_synced_at":"2026-04-20T14:15:18.413Z","repository":{"id":46915450,"uuid":"163265500","full_name":"thekoushik/gateman","owner":"thekoushik","description":"Simple and easiest JSON validator","archived":false,"fork":false,"pushed_at":"2022-12-28T07:47:56.000Z","size":241,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-15T07:00:03.737Z","etag":null,"topics":["javascript","json","validation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/thekoushik.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":"2018-12-27T07:58:48.000Z","updated_at":"2023-01-31T17:09:05.000Z","dependencies_parsed_at":"2023-01-31T06:15:14.773Z","dependency_job_id":null,"html_url":"https://github.com/thekoushik/gateman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thekoushik/gateman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekoushik%2Fgateman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekoushik%2Fgateman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekoushik%2Fgateman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekoushik%2Fgateman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thekoushik","download_url":"https://codeload.github.com/thekoushik/gateman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekoushik%2Fgateman/sbom","scorecard":{"id":879024,"data":{"date":"2025-08-11","repo":{"name":"github.com/thekoushik/gateman","commit":"acf168f3a98d963065f8e41e3f118c01ea43079e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"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":"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":"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":"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":"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":"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/17 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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T07:18:29.095Z","repository_id":46915450,"created_at":"2025-08-24T07:18:29.095Z","updated_at":"2025-08-24T07:18:29.095Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["javascript","json","validation"],"created_at":"2026-04-20T14:15:17.161Z","updated_at":"2026-04-20T14:15:18.395Z","avatar_url":"https://github.com/thekoushik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gateman\nSimple and easiest JSON validator\n\n# Documentation\nsee [docs.md](docs.md)\n\n# Installation\n```\nnpm install gateman\n```\n\n# Basic Usage\n```javascript\nvar gateman=require('gateman');\nvar validate=gateman({\n    name:\"string|minlength:5|required\",\n    age:\"number|required\",\n    dob:\"date\",\n    password:\"required|minlength:4\",\n    confirm_password:\"same:password\",\n    address:{\n        country:\"string\",\n        city:\"string|required\",\n    },\n    tags:[\"string|$maxcount:2\"]\n});\nvar err=validate({\n    name:\"Koushik\",\n    age:28,\n    dob:\"1990-04-01\",\n    address:{\n        country:\"India\"\n    },\n    password:\"abcd\",\n    confirm_password:\"abcd\",\n    tags:[\"javascript\",\"json\"]\n});\nif(!err) console.log(\"Valid\");\nelse console.log(err);\n```\n\n# Rules\n\n|Rule|Description|Param Type|Example|\n|-|-|-|-|\n|string|String type check| |``` { name: \"string\" } ```|\n|number|Number type check| |``` { age: \"number\" } ```|\n|date|Date or not| |``` { dob: \"date\" } ```|\n|email|Email or not| |``` { email: \"email\" } ```|\n|required|Value given or not| |``` { address: \"required\" } ```|\n|requiredif|Required if another field is given|string| ``` { city: \"string\", address: \"string | requiredif: city\" } ``` |\n|min|Minimum value check|number|``` { price: \"min:100\" } ```|\n|max|Maximum value check|number|``` { price: \"max:1000\" } ```|\n|minlength|Minimum length check|number|``` { password: \"minlength:5\" } ```|\n|maxlength|Maximum length check|number|``` { description: \"maxlength:200\" } ```|\n|digit|Number of digit check|number|``` { pincode: [\"digit:6\"] } ```|\n|mindigit|Minimum number of digit check|number|``` { amount: [\"mindigit:3\"] } ```|\n|maxdigit|Maximum number of digit check|number|``` { amount: [\"maxdigit:6\"] } ```|\n|uppercase|All characters are uppercase or not| |``` { name: \"uppercase\" } ```|\n|lowercase|All characters are lowercase or not| |``` { name: \"lowercase\" } ```|\n|same|Value to be same as other field|string|``` { password: \"minlength:5\", confirm_password: \"same:password\" } ```|\n|accepted|Value to be truthy(eg. ```true``` or ```1``` )| |``` { terms: \"accepted\" } ```|\n|range|Value between 2 numbers(inclusive)| |``` { price: \"range : 100 : 200\" } ```|\n\n# Array Rules\n\nArray rules operate on whole array and are prefixed with `$` symbol.\n\n|Rule|Description|Param Type|Example|\n|-|-|-|-|\n|required|Atleast one array item is required| |``` { address: [\"$required\"] } ```|\n|count|Array length check|number|``` { tags: [\"$count:2\"]} ```|\n|mincount|Minimum array length check|number|``` { tags: [\"$mincount:2\"] } ```|\n|maxcount|Maximum array length check|number|``` { tags: [\"$maxcount:2\"] } ```|\n\n## Using array rules in keys\n\n```javascript\n{\n\tfavourites:[\n        {\n            \"$mincount\": 2,\n            \"$maxcount\": 10,\n            rating:\"number | required\"\n        }\n    ]\n}\n```\n\na valid json with respect to the above schema would be\n\n```javascript\n{\n\tfavourites:[\n        {\n            rating: 44\n        },{\n            rating: 22\n        }\n    ]\n}\n```\n\n# Using with ***expressjs***\n```javascript\nvar express = require('express');\nvar app = express();\n\nvar bodyParser = require('body-parser');\napp.use(bodyParser.json());\n\nvar gateman = require('gateman');\n//the following higher order function creates expressjs middleware\nvar validate = (schema, customMessages, customValidators)=\u003e{\n\tvar validatorFn = gateman(schema, customMessages, customValidators);\n\treturn (req,res,next)=\u003e{\n\t\tvar errors = validatorFn(req.body,{flatten:true});\n        if (errors) {\n            return res.status(422).json({\n                success: false,\n                error: errors\n            })\n        }\n\t\tnext();\n\t}\n}\n//use the middleware\napp.post('/demo', validate({\n    email:\"email|required\",\n    location:\"string|required|minlength:10\"\n}), (req, res) =\u003e {\n\tres.json({\n\t\tsuccess: true,\n\t\tdata: req.body\n\t});\n});\n\napp.listen(8080, () =\u003e {\n\tconsole.log('App is live at 8080');\n});\n```\n\n# WIP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekoushik%2Fgateman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthekoushik%2Fgateman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekoushik%2Fgateman/lists"}