
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
better-avj-errors
Advanced tools
JSON Schema validation for Human
Main goal of this library is to provide relevant error messages like the following:
You can also use it in "return" mode when library returns structured errors.
$ yarn add better-avj-errors
$ # Or
$ npm i better-avj-errors
Also make sure that you installed ajv package to validate data against JSON schemas.
You need to validate data first with ajv. Then you can pass validate.errors
object into better-ajv-errors
.
import Ajv from 'ajv';
// const Ajv = require('ajv');
import betterAjvErrors from 'better-avj-errors';
// const betterAjvErrors = require('better-avj-errors');
// You need to pass `jsonPointers: true`
const ajv = new Ajv({ jsonPointers: true });
// Load schema and data
const schema = ...;
const data = ...;
const validate = ajv.compile(schema);
const valid = validate(data);
// ...validate data first
const print = betterAjvErrors({ schema, mode: 'print', indent: 2 });
if (!valid) {
print(data, validate.errors);
}
// ...validate data first
const getHumanErrors = betterAjvErrors({ schema, mode: 'return', indent: 2 });
if (!valid) {
const errors = getHumanErrors(data, validate.errors);
/*
errors is array: [
{
"error": "You're using invalid field FOO",
"line": 14,
"column": 75,
"suggestion": "Maybe you meant BAR?"
}
]
*/
}
FAQs
JSON Schema validation for Human
The npm package better-avj-errors receives a total of 8 weekly downloads. As such, better-avj-errors popularity was classified as not popular.
We found that better-avj-errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.