UNPKG

@jirutka/ajv-cli

Version:

CLI for Ajv JSON Schema Validator with human-friendly error messages

34 lines (33 loc) 1.48 kB
import type { VerboseErrorObject } from './types.js'; type Options = { dataVar?: string; }; type TextOptions = Options & { separator?: string; }; type SimpleError = { message: string; instancePath: string; schemaPath: string; schema?: any; parentSchema?: object; data?: any; }; /** * Get usable, human readable, simple error messages from ajv errors. * @param {VerboseErrorObject[]} errors - The errors created as a result of calling ajv.validate(). * @param {TextOptions=} options - Configuration options to help give the best result. * @param {string} [options.dataVar='data'] - The text to use for the root of the data variable. * @param {string} [options.separator=', '] - The text to use for the separator between errors. * @return {string} All errors, delimited by the specified separator */ export declare function getSimpleErrorText(errors: VerboseErrorObject[] | null, options?: TextOptions): string; /** * Get usable, human readable, simple error messages from ajv errors. * @param {VerboseErrorObject[]} errors - The errors created as a result of calling ajv.validate(). * @param {Options=} options - Configuration options to help give the best result. * @param {string} [options.dataVar='data'] - The text to use for the root of the data variable. * @return {SimpleError[]} An array of simple errors. */ export declare function getSimpleErrors(errors: VerboseErrorObject[] | null, options?: Options): SimpleError[]; export {};