{"id":24922933,"url":"https://github.com/demsking/jsonschemav","last_synced_at":"2026-04-30T17:31:18.868Z","repository":{"id":70414147,"uuid":"90562798","full_name":"demsking/jsonschemav","owner":"demsking","description":"A basic JSON Schema Validator","archived":false,"fork":false,"pushed_at":"2020-08-05T12:56:23.000Z","size":394,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-16T14:29:03.193Z","etag":null,"topics":["async","json","schema","validation"],"latest_commit_sha":null,"homepage":"https://gitlab.com/demsking/jsonschemav","language":"JavaScript","has_issues":false,"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/demsking.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-05-07T21:24:18.000Z","updated_at":"2023-03-05T04:59:02.000Z","dependencies_parsed_at":"2023-02-26T02:30:29.714Z","dependency_job_id":null,"html_url":"https://github.com/demsking/jsonschemav","commit_stats":{"total_commits":79,"total_committers":2,"mean_commits":39.5,"dds":"0.012658227848101222","last_synced_commit":"95515219f834e9ff0f02e296f0b735f2438e5b82"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/demsking/jsonschemav","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fjsonschemav","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fjsonschemav/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fjsonschemav/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fjsonschemav/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demsking","download_url":"https://codeload.github.com/demsking/jsonschemav/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fjsonschemav/sbom","scorecard":{"id":333783,"data":{"date":"2025-08-11","repo":{"name":"github.com/demsking/jsonschemav","commit":"95515219f834e9ff0f02e296f0b735f2438e5b82"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":-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":"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":"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":"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":"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":"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":0,"reason":"45 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-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-wg6g-ppvx-927h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-9q5w-79cv-947m","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq","Warn: Project is vulnerable to: GHSA-g3ch-rx76-35fx","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-18T04:11:52.054Z","repository_id":70414147,"created_at":"2025-08-18T04:11:52.055Z","updated_at":"2025-08-18T04:11:52.055Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32472396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"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":["async","json","schema","validation"],"created_at":"2025-02-02T11:34:09.855Z","updated_at":"2026-04-30T17:31:18.844Z","avatar_url":"https://github.com/demsking.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Schema Validator\n\nA basic JSON Schema Validator\n\n[![npm](https://img.shields.io/npm/v/jsonschemav.svg)](https://www.npmjs.com/package/jsonschemav)\n[![Build status](https://gitlab.com/demsking/jsonschemav/badges/master/pipeline.svg)](https://gitlab.com/demsking/jsonschemav/pipelines)\n[![Test coverage](https://gitlab.com/demsking/jsonschemav/badges/master/coverage.svg)](https://gitlab.com/demsking/jsonschemav/pipelines)\n\n\u003e **DISCLAIMER**: This is a basic JSON Schema validator implementation,\n  it dont implement the full JSON Schema spec, so **it's should never used in production**.\n  For a faster and powerful JSON Schema validator, please use [AJV](https://www.npmjs.com/package/ajv)\n\n## Install\n\n```sh\nnpm install --save jsonschemav\n```\n\n## Usage\n\n```javascript\nconst JsonSchemav = require('jsonschemav')\nconst jsv = new JsonSchemav()\n\nconst schema = {\n  type: 'object',\n  properties: {\n    title: { type: 'string', minLength: 6 },\n    date: { type: 'string', format: 'date', default: 'now()' }\n  }\n}\nconst data = { title: 'Hello, World!' }\nconst validator = jsv.compile(schema)\n\nvalidator\n  .then((instance) =\u003e instance.validate(datta))\n  .then((parsedData) =\u003e {\n    // use `parsedData` instead `data`\n    console.log(parsedData)\n    // { title: 'Hello, World!',\n    //   date: '2017-06-12T18:49:14.739Z' }\n  })\n\nvalidator\n  .then((instance) =\u003e instance.validate('Hello'))\n  .catch((err) =\u003e {\n    console.error(err.errors)\n    // [ { keyword: 'minLength',\n    //    size: 5,\n    //    minLength: 6,\n    //    message: 'not enough characters. must be greater than, or equal to, 6' } ]\n  })\n\nvalidator\n  .then((instance) =\u003e instance.validate(true))\n  .catch((err) =\u003e {\n    console.error(err.errors)\n    // [ { keyword: 'type', message: 'invalid type input' } ]\n  })\n```\n\n### Async Validation\n\n```javascript\nconst axios = require('axios')\nconst JsonSchemav = require('jsonschemav')\n\nconst jsv = new JsonSchemav()\nconst schema = { type: 'string', isTwitterAccount: true }\nconst endpoint = 'https://twitter.com/users/username_available'\nconst validationFn = (value, data) =\u003e {\n  // value is the keyword value\n  // data.value is the user data\n\n  if (value === true) {\n    return axios.get(`${endpoint}?username=${data.value}`)\n      .then((response) =\u003e {\n        if (response.data.valid) {\n          const message = `The username '${data.value}' does not exists`\n          const err = new Error()\n\n          err.props = { message }\n\n          throw err\n        }\n\n        return Promise.resolve(data.value)\n      })\n  }\n\n  return true\n}\n\njsv.addKeyword('string', 'isTwitterAccount', validationFn)\n\nconst validator = jsv.compile(schema)\n\nvalidator\n  .then((instance) =\u003e instance.validate('nonexistingac'))\n  .catch((err) =\u003e {\n    console.error(err.errors)\n    // [ { message: 'The username \\'nonexistingac\\' does not exists',\n    //     keyword: 'isTwitterAccount' } ]\n\n  })\n\nvalidator\n  .then((instance) =\u003e instance.validate('demsking'))\n  .then((parsedData) =\u003e {\n    console.log('success')\n  })\n```\n\n## JSV API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n- [validateSchema()](#validateschema)\n- [compile()](#compile)\n- [addCompileStep()](#addcompilestep)\n- [addAlias()](#addalias)\n- [addType()](#addtype)\n- [removeType()](#removetype)\n- [addKeyword()](#addkeyword)\n- [removeKeyword()](#removekeyword)\n\n### validateSchema()\n\nValidate a schema. Throws an error for invalid schema\n\n#### Parameters\n\n-   `schema` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Schema to validate\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\nconst schema = { type: 'string' }\n\ntry {\n  jsv.validateSchema(schema)\n} catch (err) {\n  console.error(err)\n}\n```\n\n### compile()\n\nCompile a schema\n\n#### Parameters\n\n-   `schema` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Schema to compile\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\nconst schema = {\n  type: 'object',\n  properties: {\n    title: { type: 'string' },\n    date: { type: 'string', format: 'date', default: 'now()' }\n  }\n}\nconst data = { title: 'Hello, World!' }\n\njsv.compile(schema)\n  .then((instance) =\u003e instance.validate(data))\n  .then((parsedData) =\u003e {\n     // use `parsedData` instead `data`\n     console.log(parsedData)\n     // { title: 'Hello, World!',\n     //   date: '2017-06-12T18:49:14.739Z' }\n  })\n  .catch((err) =\u003e {\n     console.error(err.errors) // a list of parsing error\n  })\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** Returns the validation interface on success and an error otherwise\n\n### addCompileStep()\n\nAdd a compile step function to a type\n\n#### Parameters\n\n-   `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the type\n-   `compileStepFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compile function\n\n### addAlias()\n\nAdd an alias for a type\n\n#### Parameters\n\n-   `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of a defined type\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The alias name\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\nconst schema = { type: 'int' }\nconst data = 123\n\njsv.addAlias('integer', 'int')\njsv.compile(schema)\n  .then((instance) =\u003e instance.validate(data))\n  .then((parsedData) =\u003e {\n     // use `parsedData` instead `data`\n     console.log(parsedData) // 123\n  })\n  .catch((err) =\u003e {\n     // err.errors is a list of parsing error\n  })\n```\n\n### addType()\n\nAdd a new type to the instance\n\n#### Parameters\n\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the new type\n-   `validateFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** A validate function for the new type\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\nconst validateFn = (data) =\u003e {\n  return Number.isInteger(data.value) \u0026\u0026 /^[01]+$/.test(data.value.toString())\n}\n\njsv.addType('binary', validateFn)\n\nconst schema = { type: 'binary' }\nconst data = 1111011\nconst instance = jsv.compile(schema)\n\njsv.compile(schema)\n  .then((instance) =\u003e instance.validate(data))\n  .then((parsedData) =\u003e {\n    // use `parsedData` instead `data`\n    console.log(parsedData) // 1111011\n  })\n```\n\n### removeType()\n\nRemove a type from the instance\n\n#### Parameters\n\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The nema of the type\n\n#### Examples\n\n```javascript\nconst schema = { type: 'string' }\nconst jsv = new JsonSchemav()\n\njsv.removeType('string')\n\ntry {\n  jsv.validateSchema(schema)\n} catch (err) {\n  console.error(err) // Error: Unknown type 'string'\n}\n```\n\n### addKeyword()\n\nAdd a new keyword to a type\n\n#### Parameters\n\n-   `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the type\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the new keyword\n-   `validateFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A validate function for the new keyword\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\nconst validateFn = function (value, data) {\n  // value is the keyword value\n  // data.value is the user data\n  // the function must returns:\n  //   - true: for a success validation\n  //   - false: for a faillure validate\n  //   - an object { message, errors }\n  //   - a Promise for async validation\n\n  return new Promise((resolve, reject) =\u003e {\n    //...\n  })\n}\n\njsv.addKeyword('string', 'provider', validateFn)\n\n// and then\nconst schema = {\n  type: 'object',\n  properties: {\n    account: { type: 'string', provider: 'twitter' }\n  }\n}\n```\n\n### removeKeyword()\n\nRemove a keyword from a type\n\n#### Parameters\n\n-   `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the type\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the keyword\n\n#### Examples\n\n```javascript\nconst jsv = new JsonSchemav()\n\njsv.removeKeyword('string', 'minLength')\n\nconst schema = { type: 'string', minLength: 5 }\nconst instance = jsv.compile(schema)\nconst data = 'abc'\n\njsv.compile(schema)\n  .then((instance) =\u003e instance.validate(data))\n  .then((parsedData) =\u003e {\n     // success\n  })\n```\n\n## License\n\nUnder the MIT license. See [LICENSE](https://gitlab.com/demsking/jsonschemav/blob/master/LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemsking%2Fjsonschemav","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemsking%2Fjsonschemav","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemsking%2Fjsonschemav/lists"}