UNPKG

@jirutka/ajv-cli

Version:

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

244 lines (243 loc) 9.26 kB
import { InferOptions } from '../args-parser.js'; declare const optionsSchema: { changes: (input: string) => boolean | "json" | "json-oneline" | "js"; errors: { type: ((input: string) => "json" | "json-oneline" | "js" | "code-climate" | "jsonpath" | "line" | "pretty" | "no") & { expectedValues: string[]; parse: (input: string) => "json" | "json-oneline" | "js" | "code-climate" | "jsonpath" | "line" | "pretty" | "no" | undefined; }; default: "pretty"; }; errorsLocation: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; mergeErrors: { type: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; default: boolean; }; _: { type: [StringConstructor]; minItems: number; }; allowMatchingProperties: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; allowUnionTypes: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; strict: (input: string) => boolean | "log"; strictNumbers: (input: string) => boolean | "log"; strictRequired: (input: string) => boolean | "log"; strictSchema: (input: string) => boolean | "log"; strictTuples: (input: string) => boolean | "log"; strictTypes: (input: string) => boolean | "log"; validateFormats: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; allErrors: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; comment: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; data: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; verbose: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; coerceTypes: (input: string) => boolean | "array"; removeAdditional: (input: string) => boolean | "all" | "failing"; useDefaults: (input: string) => boolean | "empty"; codeEs5: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeEsm: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeFormats: StringConstructor; codeLines: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeOptimize: (input: string) => number | boolean; inlineRefs: (input: string) => number | boolean; loopEnum: ((input: string) => number) & { expectedValues: string[]; parse: (input: string) => number | undefined; }; loopRequired: ((input: string) => number) & { expectedValues: string[]; parse: (input: string) => number | undefined; }; messages: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; multipleOfPrecision: (input: string) => number | boolean; ownProperties: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; keywords: { type: [StringConstructor]; alias: string; }; metaSchema: { type: [StringConstructor]; alias: string; }; refSchema: { type: [StringConstructor]; alias: string; }; schema: { required: true; type: [StringConstructor]; alias: string; default: () => string[]; }; spec: { type: ((input: string) => "jtd" | "draft7" | "draft2019" | "draft2020") & { expectedValues: string[]; parse: (input: string) => "jtd" | "draft7" | "draft2019" | "draft2020" | undefined; }; }; }; type Options = InferOptions<typeof optionsSchema>; declare const _default: { options: { changes: (input: string) => boolean | "json" | "json-oneline" | "js"; errors: { type: ((input: string) => "json" | "json-oneline" | "js" | "code-climate" | "jsonpath" | "line" | "pretty" | "no") & { expectedValues: string[]; parse: (input: string) => "json" | "json-oneline" | "js" | "code-climate" | "jsonpath" | "line" | "pretty" | "no" | undefined; }; default: "pretty"; }; errorsLocation: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; mergeErrors: { type: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; default: boolean; }; _: { type: [StringConstructor]; minItems: number; }; allowMatchingProperties: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; allowUnionTypes: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; strict: (input: string) => boolean | "log"; strictNumbers: (input: string) => boolean | "log"; strictRequired: (input: string) => boolean | "log"; strictSchema: (input: string) => boolean | "log"; strictTuples: (input: string) => boolean | "log"; strictTypes: (input: string) => boolean | "log"; validateFormats: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; allErrors: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; comment: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; data: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; verbose: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; coerceTypes: (input: string) => boolean | "array"; removeAdditional: (input: string) => boolean | "all" | "failing"; useDefaults: (input: string) => boolean | "empty"; codeEs5: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeEsm: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeFormats: StringConstructor; codeLines: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; codeOptimize: (input: string) => number | boolean; inlineRefs: (input: string) => number | boolean; loopEnum: ((input: string) => number) & { expectedValues: string[]; parse: (input: string) => number | undefined; }; loopRequired: ((input: string) => number) & { expectedValues: string[]; parse: (input: string) => number | undefined; }; messages: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; multipleOfPrecision: (input: string) => number | boolean; ownProperties: ((input: string) => boolean) & { expectedValues: string[]; parse: (input: string) => boolean | undefined; }; keywords: { type: [StringConstructor]; alias: string; }; metaSchema: { type: [StringConstructor]; alias: string; }; refSchema: { type: [StringConstructor]; alias: string; }; schema: { required: true; type: [StringConstructor]; alias: string; default: () => string[]; }; spec: { type: ((input: string) => "jtd" | "draft7" | "draft2019" | "draft2020") & { expectedValues: string[]; parse: (input: string) => "jtd" | "draft7" | "draft2019" | "draft2020" | undefined; }; }; }; execute: typeof validate; }; export default _default; declare function validate(opts: Options, dataFiles: string[]): Promise<boolean>;