UNPKG

803 BTypeScriptView Raw
1import { JsonSchema } from '@naturalcycles/js-lib';
2import type { FastGlobOptions } from '../..';
3import { AjvSchema, AjvSchemaCfg } from './ajvSchema';
4/**
5 * Does fs.readFileSync + JSON.parse for ALL files matching the passed `glob` pattern.
6 * E.g `someDir/**\/*.schema.json`
7 *
8 * Returns them as an array of JsonSchema.
9 *
10 * @experimental
11 */
12export declare function readJsonSchemas(patterns: string | string[], opt?: FastGlobOptions): JsonSchema[];
13/**
14 * Reads json schemas from given dir (glob pattern).
15 * Creates new AjvSchema for each of them (ajv validates them upon creation).
16 * Passes `schemas` option to ajv, so, schemas may $ref each other and it'll be fine.
17 *
18 * @experimental
19 */
20export declare function readAjvSchemas(patterns: string | string[], cfg?: AjvSchemaCfg): AjvSchema[];