{"id":34041620,"url":"https://github.com/polydojo/vf","last_synced_at":"2026-04-08T15:31:02.027Z","repository":{"id":82887239,"uuid":"316305800","full_name":"polydojo/vf","owner":"polydojo","description":"Validation Functions (for py dicts)","archived":false,"fork":false,"pushed_at":"2020-11-27T09:58:44.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-23T01:45:13.041Z","etag":null,"topics":["dict","python","python-validator","schema","schema-validation","validation","validation-library"],"latest_commit_sha":null,"homepage":"","language":"Python","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/polydojo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-26T18:11:24.000Z","updated_at":"2020-11-27T09:58:34.000Z","dependencies_parsed_at":"2023-03-23T17:34:19.553Z","dependency_job_id":null,"html_url":"https://github.com/polydojo/vf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/polydojo/vf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polydojo%2Fvf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polydojo%2Fvf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polydojo%2Fvf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polydojo%2Fvf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polydojo","download_url":"https://codeload.github.com/polydojo/vf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polydojo%2Fvf/sbom","scorecard":{"id":740388,"data":{"date":"2025-08-11","repo":{"name":"github.com/polydojo/vf","commit":"457b6f26c06f44c9adcab2ea04c48eafb677c323"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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/3 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":"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":"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":"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":"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":"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":"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.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt: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 '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"}}]},"last_synced_at":"2025-08-22T17:15:30.346Z","repository_id":82887239,"created_at":"2025-08-22T17:15:30.346Z","updated_at":"2025-08-22T17:15:30.346Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31562684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["dict","python","python-validator","schema","schema-validation","validation","validation-library"],"created_at":"2025-12-13T22:04:28.694Z","updated_at":"2026-04-08T15:31:02.019Z","avatar_url":"https://github.com/polydojo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"VF: Validation Functions (for py dicts.)\n========================\n\nVF is a simple tool for validating the **schema** of dict-like Python objects. It is well suited for validating user-submitted forms, JSON requests, etc.\n\n## Installation\nInstall via pip:\n```\npip install vf\n```\nOr download `vf.py` into your project directory.\n\n\n## Quickstart\nCreate a validator function by supplying a schema:\n```py\nimport vf;\npersonValidator = vf.dictOf({\n    \"_id\": vf.typeIs(str),\n    \"name\": vf.dictOf({\n        \"first\": vf.typeIs(str),\n        \"last\": lambda x: type(x) is str,\n    }),\n    \"birth_timestamp\": vf.typeIs(int),\n    \"gender\": lambda x: x in [\"MALE\", \"FEMALE\", \"OTHER\"],\n    \"parentIdList\": vf.listOf(vf.typeIs(str)),\n    \"spouceId\": lambda x: x is None or type(x) is str,\n    \"childrenIdList\": vf.listOf(vf.typeIs(str)),\n});\n```\n`vf.dictOf(.)` returns a function for schema validation. (Above, `personValidator` is the returned validation function.)\n\nUse the validator function to test if dicts are valid:\n```py\npersonValidator({\n    \"_id\": \"00a3\",\n    \"name\": {\"first\": \"John\", \"last\": \"Doe\"},\n    \"birth_timestamp\": 318191400000,\n    \"gender\": \"MALE\",\n    \"parentIdList\": [\"00a1\", \"00a2\"],\n    \"spouceId\": \"87b1\",\n    \"childrenIdList\": [\"00a6\", \"00a8\"],\n}); # Returns `True` =\u003e Valid\n```\nIf validation fails, a `vf.ValidationError` will be raised:\n```py\npersonValidator({\n    \"_id\": \"1c3f\",\n    \"name\": {\"first\": \"Jane\", \"last\": \"Doe\"},\n    \"birth_timestamp\": \"1990-01-01\",# NOT int =\u003e Invalid\n    \"gender\": \"FEMALE\",\n    \"parentIdList\": [\"1c3a\", \"1c3b\"],\n    \"spouceId\": None,\n    \"childrenIdList\": [],\n}); # Raises `vf.ValidationError` =\u003e Invalid\n```\n\nSchema Validation: How It Works\n-----------------------------------------\n\nThe schema supplied to `vf.dictOf(.)` should be a `dict`, where each value is a function. In the above example, `vf.typeIs(str)` is a shorthand for `lambda x: type(x) is str`.\n\nFor validating a test-dict `tDict` against a schema `schema`, we first ensure that the two have matching keys. Then, each value in `tDict` is supplied to the corresponding function in `schema`. If that function returns `True` (or a truthy value), the key/value pair is considered to be valid, invalid otherwise.\n\nVF includes a number of helpers for generating simple type-checking functions, which are documented below. But as a quick example,\n\n- `vf.typeIs(int)` returns a function for checking if the type of it's argument is an `int`.\n- `vf.listOf(vf.typeIs(str))` returns a function for checking for a list of strings.\n- `vf.allOf(vf.truthy, vf.typeIs(str))` returns a function that checks for non-blank (i.e. truthy) strings.\n\n#### Write Your Own `lambda`s!\n\nPlease note that you aren't limited to VF's helpers. You can write any `lambda` (or reference a `def`'d function) in your schema. For example:\n- instead of `vf.allOf(vf.truthy, vf.typeIs(str))`,\n- you may write `lambda x: x and type(x) is str`.\n\nMore importantly, you will likely have custom validation logic that VF can't anticipate. For example, you may want to match integers between `10` and `1500`. In that case, you could use something like:  \n- `lambda x: type(x) is int and 10 \u003c= x \u003c= 1500`\n\nQuick Plug\n--------------\nVF built and maintained by the folks at [Polydojo, Inc.](https://www.polydojo.com/), led by [Sumukh Barve](https://www.sumukhbarve.com/). If your team is looking for a simple project management tool, please check out our latest product: [**BoardBell.com**](https://www.boardbell.com/).\n\nHelper Nomenclature\n---------------------------\n\nAt Polydojo, boolean variables are typically given names starting with `is`, `did`, etc. That is, `isNone`, `isType`, `didConfirm` etc. would typically be booleans. Thus, instead of `isType`, VF includes `typeIs(.)`, which is a *helper* that returns a *function* for type-checking.\n\nList Of Helpers\n------------------\n### Simple functions:\n\nThese helpers are simple functions that return `True` or `False`.\n\n- `vf.truthy`: Helper function for checking truthy-ness.\n- `vf.falsy`: Helper function for checking falsy-ness.\n- `vf.noneIs`: Helper for checking `None`.\n\n### Helpers for generating functions:\n\nThese helpers return type-checking functions, which in-turn return `True` or `False`. Here-below, the phrase ***\"Makes `func(x)` for ...\"*** should be read as ***\"Returns a function on `x` for ...\"***\n\n- `vf.typeIs(typ)`: Makes `func (x)` for checking `type(x) is typ`.\n- `vf.typeIn(*typs)`: Makes `func (x)` for checking `type(x) in typs`.\n- `vf.instanceOf(*typs)`: Makes `func (x)` for checking `isinstance(x, typs)`.\n- `vf.patternIs(pattern)`: Makes `func (s)` for checking `s` against `pattern` via `re.match` or `re.Pattern.match`. (`s` may be a `str` or a compiled `re.Pattern`.)\n- `allOf (*fns)`: Makes `func (x)` for checking `all(fn(x) for fn in fns)`.;\n- `anyOf (*fns)`: Makes `func (x)` for checking `any(fn(x) for fn in fns)`.\n- `listOf (fn, minLen=0)`: Makes `func (li)` for checking `isinstance(li, list)`, `len(li) \u003e= minLen` and `all(fn(x) for x in li)`.\n\n#### Dict Validation:\nAnd finally, of course, the dict validation function:\n\n- `dictOf(schema, extraKeysOk=False)`: Makes `func (d)` for **validating** `d` against `schema`. Raises `vf.ValidationError` if validation fails.\n\nIf `extraKeysOk=True` is passed, it is then acceptable for `d.keys()` to be a superset of `schema.keys()`. Otherwise, `d.keys()` must exactly match `schema.keys()` (irrespective of key-order).\n\nTesting \u0026 Contributing\n---------------------------\n\nInstall pytest via `pip install -U pytest`. Run tests with:\n```\npytest\n```\n\nIf you encounter a bug, please open an issue on GitHub; but if you find a security vulnerability, please email security@polydojo.com instead.\n\nIf you'd like to see a new feature or contribute code, please open a GitHub issue. We'd love to hear from you! Suggestions and code contributions will always be appreciated, big and small.\n\nLicensing\n------------\nCopyright (c) 2020 Polydojo, Inc.\n\n**Software Licensing:**  \nThe software is released \"AS IS\" under the **MIT License**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Kindly see [LICENSE.txt](https://github.com/polydojo/vf/blob/master/LICENSE.txt) for more details.\n\n**No Trademark Rights:**  \nThe above software licensing terms **do not** grant any right in the trademarks, service marks, brand names or logos of Polydojo, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolydojo%2Fvf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolydojo%2Fvf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolydojo%2Fvf/lists"}