Gathering detailed insights and metrics for @apideck/better-ajv-errors
Gathering detailed insights and metrics for @apideck/better-ajv-errors
Gathering detailed insights and metrics for @apideck/better-ajv-errors
Gathering detailed insights and metrics for @apideck/better-ajv-errors
Human-friendly JSON Schema validation for APIs 👮♀️
npm install @apideck/better-ajv-errors
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.6
Supply Chain
89.5
Quality
82.2
Maintenance
100
Vulnerability
99.6
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
43 Stars
62 Commits
9 Forks
5 Watchers
8 Branches
6 Contributors
Updated on Apr 22, 2025
Latest Version
0.3.6
Package Id
@apideck/better-ajv-errors@0.3.6
Unpacked Size
75.72 kB
Size
13.53 kB
File Count
23
NPM Version
8.6.0
Node Version
14.17.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
Human-friendly JSON Schema validation for APIs
1$ yarn add @apideck/better-ajv-errors
or
1$ npm i @apideck/better-ajv-errors
Also make sure that you've installed ajv at version 8 or higher.
After validating some data with ajv, pass the errors to betterAjvErrors
1import Ajv from 'ajv'; 2import { betterAjvErrors } from '@apideck/better-ajv-errors'; 3 4// Without allErrors: true, ajv will only return the first error 5const ajv = new Ajv({ allErrors: true }); 6 7const valid = ajv.validate(schema, data); 8 9if (!valid) { 10 const betterErrors = betterAjvErrors({ schema, data, errors: ajv.errors }); 11}
Function that formats ajv validation errors in a human-friendly format.
options: BetterAjvErrorsOptions
errors: ErrorObject[] | null | undefined
Your ajv errors, you will find these in the errors
property of your ajv instance (ErrorObject
is a type from the ajv package).data: Object
The data you passed to ajv to be validated.schema: JSONSchema
The schema you passed to ajv to validate against.basePath?: string
An optional base path to prefix paths returned by betterAjvErrors
. For example, in APIs, it could be useful to use '{requestBody}'
or '{queryParemeters}'
as a basePath. This will make it clear to users where exactly the error occurred.ValidationError[]
Array of formatted errors (properties of ValidationError
below)
message: string
Formatted error messagesuggestion?: string
Optional suggestion based on provided data and schemapath: string
Object path where the error occurred (example: .foo.bar.0.quz
)context: { errorType: DefinedError['keyword']; [additionalContext: string]: unknown }
errorType
is error.keyword
proxied from ajv
. errorType
can be used as a key for i18n if needed. There might be additional properties on context, based on the type of error.No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/18 approved changesets -- score normalized to 1
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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