Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@readme/better-ajv-errors

Package Overview
Dependencies
Maintainers
9
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@readme/better-ajv-errors

JSON Schema validation for Human

  • 1.4.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
258K
increased by8.37%
Maintainers
9
Weekly downloads
 
Created

What is @readme/better-ajv-errors?

@readme/better-ajv-errors is a utility package designed to provide more human-readable error messages when using the AJV JSON schema validator. It enhances the default error messages provided by AJV, making it easier to understand and debug validation issues.

What are @readme/better-ajv-errors's main functionalities?

Human-readable error messages

This feature allows you to generate more readable error messages from AJV validation errors. The code sample demonstrates how to use @readme/better-ajv-errors to enhance the error messages for a simple JSON schema validation.

const Ajv = require('ajv');
const betterAjvErrors = require('@readme/better-ajv-errors');

const ajv = new Ajv();
const schema = {
  type: 'object',
  properties: {
    name: { type: 'string' },
    age: { type: 'integer' }
  },
  required: ['name', 'age']
};

const data = {
  name: 'John Doe',
  age: 'twenty-five'
};

const validate = ajv.compile(schema);
const valid = validate(data);

if (!valid) {
  const output = betterAjvErrors(schema, data, validate.errors, { format: 'js' });
  console.log(output);
}

Other packages similar to @readme/better-ajv-errors

Keywords

FAQs

Package last updated on 12 Apr 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc