{"id":15501980,"url":"https://github.com/luzlab/ajv-formats-draft2019","last_synced_at":"2025-10-11T21:10:42.158Z","repository":{"id":40307379,"uuid":"244052557","full_name":"luzlab/ajv-formats-draft2019","owner":"luzlab","description":"Plugin for AJV that adds support for some of string formats adding in the draft2019 JSON Schema.","archived":false,"fork":false,"pushed_at":"2024-06-16T10:47:33.000Z","size":116,"stargazers_count":10,"open_issues_count":8,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-21T11:43:40.867Z","etag":null,"topics":[],"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/luzlab.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,"publiccode":null,"codemeta":null}},"created_at":"2020-02-29T22:45:48.000Z","updated_at":"2024-10-22T22:10:48.000Z","dependencies_parsed_at":"2024-06-18T16:43:45.232Z","dependency_job_id":null,"html_url":"https://github.com/luzlab/ajv-formats-draft2019","commit_stats":{"total_commits":54,"total_committers":9,"mean_commits":6.0,"dds":"0.20370370370370372","last_synced_commit":"6d95e646d9ee3abd05589cd82341e3130a3d66d6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luzlab/ajv-formats-draft2019","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luzlab%2Fajv-formats-draft2019","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luzlab%2Fajv-formats-draft2019/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luzlab%2Fajv-formats-draft2019/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luzlab%2Fajv-formats-draft2019/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luzlab","download_url":"https://codeload.github.com/luzlab/ajv-formats-draft2019/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luzlab%2Fajv-formats-draft2019/sbom","scorecard":{"id":606224,"data":{"date":"2025-08-11","repo":{"name":"github.com/luzlab/ajv-formats-draft2019","commit":"6d95e646d9ee3abd05589cd82341e3130a3d66d6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":2,"reason":"Found 4/14 approved changesets -- score normalized to 2","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.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":"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":"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":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/luzlab/ajv-formats-draft2019/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/luzlab/ajv-formats-draft2019/node.js.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand 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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["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-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"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-21T01:39:45.393Z","repository_id":40307379,"created_at":"2025-08-21T01:39:45.393Z","updated_at":"2025-08-21T01:39:45.393Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008731,"owners_count":26084494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"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":[],"created_at":"2024-10-02T09:06:49.660Z","updated_at":"2025-10-11T21:10:42.139Z","avatar_url":"https://github.com/luzlab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ajv-formats-draft2019\n\nAn AJV plugin adding support for draft2019 formats missing from AJV.\n\nCurrently, `iri`, `iri-reference`, `idn-email`, `idn-hostname`, and `duration`\nformats are supported. `duration` was added in draft 2019. The `uuid` format was\nadded in draft2019, but is already supported by the `ajv-formats` package.\n\n[![Node.js CI](https://github.com/luzlab/ajv-formats-draft2019/actions/workflows/node.js.yml/badge.svg)](https://github.com/luzlab/ajv-formats-draft2019/actions/workflows/node.js.yml)\n\n## Using international formats with pre-draft2019 JSON schemas\n\nThe `idn-email` and `idn-hostname` formats are implemented per RFC 1123, however\nearlier JSON schemas specify RFC 1034. This is probably just fine, but you have\nbeen warned...\n\n## Installation\n\n```sh\nnpm install --save ajv-formats-draft2019\n```\n\n## Usage\n\nThe default export is an `apply` function that patches an existing instance of\n`ajv`.\n\n```js\nconst Ajv = require('ajv');\nconst apply = require('ajv-formats-draft2019');\nconst ajv = new Ajv();\napply(ajv); // returns ajv instance, allowing chaining\n\nlet schema = {\n  type: 'string',\n  format: 'idn-email',\n};\najv.validate(schema, 'квіточка@пошта.укр'); // returns true\n```\n\nThe `apply` function also accepts a second optional parameter to specify which\nformats to add to the `ajv` instance.\n\n```js\nconst Ajv = require('ajv');\nconst apply = require('ajv-formats-draft2019');\nconst ajv = new Ajv();\n\n// Install only the idn-email and iri formats\napply(ajv, { formats: ['idn-email', 'iri'] });\n```\n\nThe module also provides an alternate entrypoint `ajv-formats-draft2019/formats`\nthat works with the `ajv` constructor to add the formats to new instances.\n\n```js\nconst Ajv = require('ajv');\nconst formats = require('ajv-formats-draft2019/formats');\nconst ajv = new Ajv({ formats });\n\nlet schema = {\n  type: 'string',\n  format: 'idn-email',\n};\najv.validate(schema, 'квіточка@пошта.укр'); // returns true\n```\n\nUsing the `ajv-formats-draft2019/formats` entry point also allows cherry picking\nformats. Note the approach below only works for formats that don't contain a\nhypen `-` in the name. This approach may yield smaller packed bundles since it\nallows tree-shaking to remove unwanted validators and related dependencies.\n\n```js\nconst Ajv = require('ajv');\nconst { duration, iri } = require('ajv-formats-draft2019/formats');\nconst ajv = new Ajv({ formats: { duration, iri } });\n```\n\n## International formats\n\nThe library also provides an `idn` export to load only the international formats\n(ie. `iri`, `iri-reference`, `idn-hostname` and `idn-email`).\n\n```js\nconst Ajv = require('ajv');\nconst formats = require('ajv-formats-draft2019/idn');\nconst ajv = new Ajv({ formats });\n```\n\n## Formats\n\n### iri\n\nThe string is parsed with 'uri-js' and the scheme is checked against the list of\nknown IANA schemes. If it's a 'mailto' schemes, all of the `to:` addresses are\nvalidated, otherwise we check there IRI includes a path and is an absolute\nreference.\n\n### iri-reference\n\nAll valid IRIs are valid. Fragments must have a valid path and of type\n\"relative\", \"same-document\" or \"uri\". If there is a scheme, it must be valid.\n\nValidating a IRI references is challenging since the syntax is so permissive.\nBasically, any URL-safe string is a valid IRI syntactically. I struggled to find\n[negative test cases](https://github.com/luzlab/ajv-formats/blob/master/index.test.js#L240)\nwhen writing the unit tests for IRI-references. Consider:\n\n- `google.com` is NOT a valid IRI because it does not include a scheme.\n- `file.txt` is a valid IRI-reference\n- `/this:that` is a valid IRI-reference\n- `this:that` is a NOT a valid IRI-reference\n\n### idn-email\n\n[`smtp-address-parser`](https://www.npmjs.com/package/smtp-address-parser) is\nused to check the validity of the email.\n\n### idn-hostname\n\nThe hostname is converted to ascii with punycode and checked for a valid tld.\n\n### duration\n\nThe string is checked against a regex.\n\n## Releases\n\n### `v1.6.1`\n\n- Updated `schemes` dependency, adding support for `modbus+tcp` and `mqtt` in URIs.\n\n### `v1.6.0`\n\n- Fix tests to work with AJV v7+ and how `ajv` is exported, rather than changes\n  to this library.\n\n### `v1.5.0`\n\n- Upgrade dependencies\n\n### `v1.4.4`\n\n- The last release that's compatible with Node 8.\n- Fixed a bug when validated `mailto:` IRIs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluzlab%2Fajv-formats-draft2019","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluzlab%2Fajv-formats-draft2019","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluzlab%2Fajv-formats-draft2019/lists"}