{"id":25662523,"url":"https://github.com/albarsil/pyschemavalidator","last_synced_at":"2026-06-22T09:32:15.040Z","repository":{"id":62583304,"uuid":"386279192","full_name":"albarsil/pyschemavalidator","owner":"albarsil","description":"A simple and lightweight python package to validate dictionary and JSON elements. It omits the need to validate the data yourself and allow its usage by many kinds of APIs through decorators or a UniversalValidator.","archived":false,"fork":false,"pushed_at":"2021-07-15T13:16:35.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T20:38:31.166Z","etag":null,"topics":["api","python","schema","validation"],"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/albarsil.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-07-15T12:19:18.000Z","updated_at":"2021-07-15T13:59:16.000Z","dependencies_parsed_at":"2022-11-03T22:16:27.922Z","dependency_job_id":null,"html_url":"https://github.com/albarsil/pyschemavalidator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/albarsil/pyschemavalidator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarsil%2Fpyschemavalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarsil%2Fpyschemavalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarsil%2Fpyschemavalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarsil%2Fpyschemavalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albarsil","download_url":"https://codeload.github.com/albarsil/pyschemavalidator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarsil%2Fpyschemavalidator/sbom","scorecard":{"id":177882,"data":{"date":"2025-08-11","repo":{"name":"github.com/albarsil/pyschemavalidator","commit":"18b6dddc41a2e48e87edd9c8744956c933a0954c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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/16 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"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":"dependency not pinned by hash detected -- score normalized to 1","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/albarsil/pyschemavalidator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/albarsil/pyschemavalidator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/albarsil/pyschemavalidator/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/albarsil/pyschemavalidator/tests.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:25","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:26","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:27","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   5 pipCommand dependencies pinned"],"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":"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":"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":"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":"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"}}]},"last_synced_at":"2025-08-16T18:09:11.293Z","repository_id":62583304,"created_at":"2025-08-16T18:09:11.293Z","updated_at":"2025-08-16T18:09:11.293Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34643614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","python","schema","validation"],"created_at":"2025-02-24T04:22:14.489Z","updated_at":"2026-06-22T09:32:15.023Z","avatar_url":"https://github.com/albarsil.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyschemavalidator\n\n[![Actions Status](https://github.com/albarsil/pyschemavalidator/workflows/Tests/badge.svg?branch=master)](https://github.com/albarsil/pyschemavalidator/actions/workflows/tests.yml)\n[![PyPI](https://img.shields.io/pypi/v/pyschemavalidator?color=g)](https://pypi.org/project/pyschemavalidator/)\n[![License](https://img.shields.io/badge/license-MIT-purple)](https://github.com/albarsil/pyschemavalidator/blob/master/LICENSE)\n\nThis package contains a decorator for endpoints in flask and a way to validate dictionary/JSON elements. \nIt omits the need to validate the data yourself and allow its usage by other kinds of APIs like graphql through the `UniversalValidator`.\n\n## Installation\n\nUse pip to install the package from PyPI:\n\n```bash\npip install pyschemavalidator\n```\n\n## Usage\n\nThis package provides a flask route decorator to validate a JSON payload or dictionary elements.\n\n```python\nfrom flask import Flask, make_response, jsonify, g, url_for\nfrom pyschemavalidator import validate_param\n\n# example imports\nfrom models import Model\n\napp = Flask(__name__)\n\n@app.route('/invocations', methods=['POST'])\n@validate_param(key=\"sepal_length\", keytype=float, isrequired=True)\n@validate_param(key=\"sepal_width\", keytype=float, isrequired=True)\n@validate_param(key=\"petal_length\", keytype=float, isrequired=True)\n@validate_param(key=\"petal_width\", keytype=float, isrequired=True)\ndef register():\n    # if the payload is invalid, the request will be aborted with the appropriate error code\n\n    # do model inference\n    data = request.get_json(silent=True, force=False)\n    \n    output = Model.predict(data.get('sepal_length'), data.get('sepal_width'), data.get('petal_length'), data.get('petal_width'))\n    return make_response(jsonify({\"output:\": output}), 200)\n```\n\nThe payload is verified through the parameters set on the decorators. If the body does not meet the decorator's specifications it returns a standard response with the appropriate error code.\n\nYou can also use the package without the decorator style as below:\n\n```python\nfrom pyschemavalidator.validators import UniversalValidator\n\n# Creates a Universal validator to the dictionary/JSON elements\nrequest_validator = UniversalValidator()\nrequest_validator.add(key=\"example1\", keytype=str, isrequired=True)\nrequest_validator.add(key=\"example2\", keytype=str, isrequired=False)\n\n# Example data\ndata = {\"example1\": \"test\", \"example2\": \"test\"}\n\n# Add some validations to the JSON/dictionary element\nstatus_code, message = request_validator.validate(\n    tag1=data.get(\"example1\"),\n    tag2=data.get(\"example2\")\n)\n\nif status_code != 200: # It means that something got wrong with the validation\n    raise ValueError(message)\nelse\n    ... # Do whatever you want\n```\n\n\n## Mimetype checking\n\nAs of 1.2.0 this decorator uses `flask.request.get_json(force=False)` to get the data. This means the mimetype of the request has to be 'application/json'.\n\n## Error handling\n\nOn validation failure, the library calls `flask.make_response` and passes the error code and the message.\n\n## Testing\n\nThe following are the steps to create a virtual environment into a folder named \"venv\" and install the requirements.\n\n```bash\n# Create virtualenv\npython3 -m venv venv\n# activate virtualenv\nsource venv/bin/activate\n# update packages\npip install --upgrade pip setuptools wheel\n# install requirements\npython setup.py install\n```\n\nTests can be run with `python setup.py test` when the virtualenv is active.\n\n# Changelog\n\n1.0.4 - Removed support to Python 2.7\n\n1.0.3 - Fix description and README\n\n1.0.2 - Fix the missing required parameter issue\n\n1.0.1 - Fix the bonduaries issue\n\n1.0.0 - First release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbarsil%2Fpyschemavalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbarsil%2Fpyschemavalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbarsil%2Fpyschemavalidator/lists"}