Gathering detailed insights and metrics for ajv-formats
Gathering detailed insights and metrics for ajv-formats
Gathering detailed insights and metrics for ajv-formats
Gathering detailed insights and metrics for ajv-formats
ajv-formats-draft2019
Plugin for AJV that adds support for some of string formats adding in the draft2019 JSON Schema.
ajv-openapi
Ajv plugin to add Open API v3 data type formats support
@jdfed/drip-form-plugin-formats
drip-form ajv formats插件
@innoways/drip-form-plugin-formats
drip-form ajv formats插件
npm install ajv-formats
Typescript
Module System
Node Version
NPM Version
TypeScript (90.56%)
JavaScript (9.44%)
Total Downloads
2,874,695,390
Last Day
1,520,704
Last Week
32,630,720
Last Month
140,145,556
Last Year
1,325,210,840
MIT License
206 Stars
109 Commits
37 Forks
4 Watchers
3 Branches
10 Contributors
Updated on Jul 05, 2025
Minified
Minified + Gzipped
Latest Version
3.0.1
Package Id
ajv-formats@3.0.1
Unpacked Size
55.43 kB
Size
15.62 kB
File Count
15
NPM Version
10.2.3
Node Version
18.19.0
Published on
Mar 30, 2024
Cumulative downloads
Total Downloads
Last Day
-1.1%
1,520,704
Compared to previous day
Last Week
-7%
32,630,720
Compared to previous week
Last Month
4%
140,145,556
Compared to previous month
Last Year
59.1%
1,325,210,840
Compared to previous year
JSON Schema formats for Ajv
1// ESM/TypeScript import 2import Ajv from "ajv" 3import addFormats from "ajv-formats" 4// Node.js require: 5const Ajv = require("ajv") 6const addFormats = require("ajv-formats") 7 8const ajv = new Ajv() 9addFormats(ajv)
The package defines these formats:
See regular expressions used for format validation and the sources that were used in formats.ts.
Please note: JSON Schema draft-07 also defines formats iri
, iri-reference
, idn-hostname
and idn-email
for URLs, hostnames and emails with international characters. These formats are available in ajv-formats-draft2019 plugin.
formatMaximum
/ formatMinimum
and formatExclusiveMaximum
/ formatExclusiveMinimum
These keywords allow to define minimum/maximum constraints when the format keyword defines ordering (compare
function in format definition).
These keywords are added to ajv instance when ajv-formats is used without options or with option keywords: true
.
These keywords apply only to strings. If the data is not a string, the validation succeeds.
The value of keywords formatMaximum
/formatMinimum
and formatExclusiveMaximum
/formatExclusiveMinimum
should be a string or $data reference. This value is the maximum (minimum) allowed value for the data to be valid as determined by format
keyword. If format
keyword is not present schema compilation will throw exception.
When these keyword are added, they also add comparison functions to formats "date"
, "time"
and "date-time"
. User-defined formats also can have comparison functions. See addFormat method.
1require("ajv-formats")(ajv) 2 3const schema = { 4 type: "string", 5 format: "date", 6 formatMinimum: "2016-02-06", 7 formatExclusiveMaximum: "2016-12-27", 8} 9 10const validDataList = ["2016-02-06", "2016-12-26"] 11 12const invalidDataList = ["2016-02-05", "2016-12-27", "abc"]
Options can be passed via the second parameter. Options value can be
1addFormats(ajv, ["date", "time"])
Please note: when ajv encounters an undefined format it throws exception (unless ajv instance was configured with strict: false
option). To allow specific undefined formats they have to be passed to ajv instance via formats
option with true
value:
1const ajv = new Ajv((formats: {date: true, time: true})) // to ignore "date" and "time" formats in schemas.
"full"
) with optional list of format names and keywords
option to add additional format comparison keywords:1addFormats(ajv, {mode: "fast"})
or
1addFormats(ajv, {mode: "fast", formats: ["date", "time"], keywords: true})
In "fast"
mode the following formats are simplified: "date"
, "time"
, "date-time"
, "iso-time"
, "iso-date-time"
, "uri"
, "uri-reference"
, "email"
. For example, "date"
, "time"
and "date-time"
do not validate ranges in "fast"
mode, only string structure, and other formats have simplified regular expressions.
1npm install 2git submodule update --init 3npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 8/20 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More