@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
21 lines (20 loc) • 803 B
TypeScript
import { JsonSchema } from '@naturalcycles/js-lib';
import type { FastGlobOptions } from '../..';
import { AjvSchema, AjvSchemaCfg } from './ajvSchema';
/**
* Does fs.readFileSync + JSON.parse for ALL files matching the passed `glob` pattern.
* E.g `someDir/**\/*.schema.json`
*
* Returns them as an array of JsonSchema.
*
* @experimental
*/
export declare function readJsonSchemas(patterns: string | string[], opt?: FastGlobOptions): JsonSchema[];
/**
* Reads json schemas from given dir (glob pattern).
* Creates new AjvSchema for each of them (ajv validates them upon creation).
* Passes `schemas` option to ajv, so, schemas may $ref each other and it'll be fine.
*
* @experimental
*/
export declare function readAjvSchemas(patterns: string | string[], cfg?: AjvSchemaCfg): AjvSchema[];