AJV decorated with error handling and formats.
Added Decorations
- added ajv-formats
- added ajv-errors
- added
errorMessage
keyword to JSONSchema7 type from @types/json-schema- filter redundant errors
- Asynchronously load referenced schemas from web.
npm i decorated-ajv
import { getAjv } from "decorated-ajv";
const ajv = getAjv(); // returns an ajv instanse with loaded ajv-errors and ajv-formats
import { getValidator } from "decorated-ajv";
const validator = await getValidator(schema, ajv); // ajv is optional
import { validate, Violation } from "decorated-ajv";
const violations: Violation = await validate(schema, data, validator); // validator is optional, if provided schema is ignored
import { getCompiledValidator } from "decorated-ajv";
const standaloneValidator = await getCompiledValidator(schema, ajvOptions); // ajvOptions is optional
Read more about standalone ajv validator here
This project is a part of the Open Source Initiative from Sodaru Technologies
Write an email to [email protected] for queries on this project