UNPKG

@jirutka/ajv-cli

Version:

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

303 lines (302 loc) 13.3 kB
export { printHelp } from './help.js'; export type CmdName = keyof typeof commands; export declare const commands: { compile: { options: { output: { type: StringConstructor; alias: string; }; _: { type: [StringConstructor]; maxItems: 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: (opts: { schema: string[]; allowMatchingProperties: boolean | undefined; allowUnionTypes: boolean | undefined; strict: boolean | "log" | undefined; strictNumbers: boolean | "log" | undefined; strictRequired: boolean | "log" | undefined; strictSchema: boolean | "log" | undefined; strictTuples: boolean | "log" | undefined; strictTypes: boolean | "log" | undefined; validateFormats: boolean | undefined; allErrors: boolean | undefined; comment: boolean | undefined; data: boolean | undefined; verbose: boolean | undefined; coerceTypes: boolean | "array" | undefined; removeAdditional: boolean | "all" | "failing" | undefined; useDefaults: boolean | "empty" | undefined; codeEs5: boolean | undefined; codeEsm: boolean | undefined; codeFormats: string | undefined; codeLines: boolean | undefined; codeOptimize: number | boolean | undefined; inlineRefs: number | boolean | undefined; loopEnum: number | undefined; loopRequired: number | undefined; messages: boolean | undefined; multipleOfPrecision: number | boolean | undefined; ownProperties: boolean | undefined; keywords: string[]; metaSchema: string[]; refSchema: string[]; spec: "jtd" | "draft7" | "draft2019" | "draft2020" | undefined; output: string | undefined; }, _args: string[]) => Promise<boolean>; }; validate: { 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: (opts: { schema: string[]; allowMatchingProperties: boolean | undefined; allowUnionTypes: boolean | undefined; strict: boolean | "log" | undefined; strictNumbers: boolean | "log" | undefined; strictRequired: boolean | "log" | undefined; strictSchema: boolean | "log" | undefined; strictTuples: boolean | "log" | undefined; strictTypes: boolean | "log" | undefined; validateFormats: boolean | undefined; allErrors: boolean | undefined; comment: boolean | undefined; data: boolean | undefined; verbose: boolean | undefined; coerceTypes: boolean | "array" | undefined; removeAdditional: boolean | "all" | "failing" | undefined; useDefaults: boolean | "empty" | undefined; codeEs5: boolean | undefined; codeEsm: boolean | undefined; codeFormats: string | undefined; codeLines: boolean | undefined; codeOptimize: number | boolean | undefined; inlineRefs: number | boolean | undefined; loopEnum: number | undefined; loopRequired: number | undefined; messages: boolean | undefined; multipleOfPrecision: number | boolean | undefined; ownProperties: boolean | undefined; keywords: string[]; metaSchema: string[]; refSchema: string[]; spec: "jtd" | "draft7" | "draft2019" | "draft2020" | undefined; changes: boolean | "json" | "json-oneline" | "js" | undefined; errors: "json" | "json-oneline" | "js" | "code-climate" | "jsonpath" | "line" | "pretty" | "no"; errorsLocation: boolean | undefined; mergeErrors: boolean; }, dataFiles: string[]) => Promise<boolean>; }; };