INNER CODE UNIT · TypeScript

cmdValidate

x-cmd/x-cmd · mod/ajv/lib/ajv.ts:412

async function cmdValidate(): Promise<number> {
    let s: Record<string, unknown>;
    try {
        s = await readJson<Record<string, unknown>>(schema);
    } catch (e) {
        const msg = e instanceof Error ? e.message : String(e);
        if (e instanceof IoError) {
            emitResult(schema, R.IoError, msg, { code: e.code });
        } else if (e instanceof ParseError) {
            emitResult(schema, R.SyntaxError, msg, { format: e.format, line: e.line, column: e.column });
        } else {
            emitResult(schema, R.IoError, msg);
        }
        return 1;
    }
    const ajv = makeAjv(typeof s.$schema === "string" ? s.$schema : undefined);
    let v: ReturnType<typeof ajv.compile>;
    try {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…