Gathering detailed insights and metrics for ajv-openapi
Gathering detailed insights and metrics for ajv-openapi
Gathering detailed insights and metrics for ajv-openapi
Gathering detailed insights and metrics for ajv-openapi
express-openapi-json
Builds an express-compatible router using OpenAPI with request and response validation.
ajv-openapi-compile
Generate a compiled AJV validation module from an OpenAPI definition.
@trojs/openapi-dereference
OpenAPI dereference
express-ajv-swagger-validation
Input validation using Swagger (Open API) and ajv
Ajv plugin to add Open API v3 data type formats support
npm install ajv-openapi
Typescript
Module System
Node Version
NPM Version
79.2
Supply Chain
100
Quality
77.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
847,106
Last Day
72
Last Week
2,980
Last Month
16,630
Last Year
206,668
3 Stars
10 Commits
1 Forks
2 Watchers
13 Branches
1 Contributors
Updated on Dec 27, 2024
Minified
Minified + Gzipped
Latest Version
2.0.0
Package Id
ajv-openapi@2.0.0
Unpacked Size
10.86 kB
Size
3.18 kB
File Count
8
NPM Version
6.10.2
Node Version
12.9.0
Cumulative downloads
Total Downloads
Last Day
4.3%
72
Compared to previous day
Last Week
-28.1%
2,980
Compared to previous week
Last Month
11.9%
16,630
Compared to previous month
Last Year
-26.8%
206,668
Compared to previous year
Ajv plugin that adds Open API v3 data types (formats: int32, int64, float, double, byte) validation.
1npm install ajv ajv-openapi
1const Ajv = require("ajv"); 2const openApi = require("ajv-openapi"); 3 4const ajv = openApi(new Ajv());
By default, the plugin only adds missing formats to Ajv validator. To configure Ajv to be fully Open API v3 compliant, you should configure the plugin like this:
1const Ajv = require("ajv"); 2const openApi = require("ajv-openapi"); 3 4const ajvOptions = { 5 schemaId: "auto", 6 format: "full", 7 coerceTypes: true, 8 unknownFormats: "ignore", 9 useDefaults: true, 10 nullable: true 11}; 12 13const openApiOptions = { 14 useDraft04: true 15}; 16 17const ajv = openApi( 18 new Ajv(ajvOptions), 19 openApiOptions 20);
1console.log(ajv.compile({ type: "integer", format: "int32" })(2147483648)); 2console.log(ajv.compile({ type: "integer", format: "int32" })(-2147483649)); 3console.log(ajv.compile({ type: "integer", format: "int32" })(1.23)); 4console.log(ajv.compile({ type: "integer", format: "int32" })(123)); 5> false 6> false 7> false 8> true 9 10console.log(ajv.compile({ type: "integer", format: "int64" })(Number.MAX_VALUE)); 11console.log(ajv.compile({ type: "integer", format: "int64" })(Number.MIN_VALUE)); 12console.log(ajv.compile({ type: "integer", format: "int64" })(1.23)); 13console.log(ajv.compile({ type: "integer", format: "int64" })(123)); 14> false 15> false 16> false 17> true 18 19console.log(ajv.compile({ type: "number", format: "float" })(Number.MAX_VALUE)); 20console.log(ajv.compile({ type: "number", format: "float" })(Number.MIN_VALUE)); 21console.log(ajv.compile({ type: "number", format: "float" })(1.23)); 22console.log(ajv.compile({ type: "number", format: "float" })(123)); 23> false 24> false 25> true 26> true 27 28console.log(ajv.compile({ type: "number", format: "double" })(Number.MAX_VALUE)); 29console.log(ajv.compile({ type: "number", format: "double" })(Number.MIN_VALUE)); 30console.log(ajv.compile({ type: "number", format: "double" })(1.23)); 31console.log(ajv.compile({ type: "number", format: "double" })(123)); 32> true 33> true 34> true 35> true 36 37console.log(ajv.compile({ type: "string", format: "byte" })("MTIz")); 38console.log(ajv.compile({ type: "string", format: "byte" })("abc")); 39console.log(ajv.compile({ type: "string", format: "byte" })(1)); 40console.log(ajv.compile({ type: "string", format: "byte" })("5L2g5aW95ZWK")); 41> true 42> false 43> false 44> true
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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