1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.readAjvSchemas = exports.readJsonSchemas = void 0;
|
4 | const fs = require("fs");
|
5 | const globby = require("globby");
|
6 | const ajvSchema_1 = require("./ajvSchema");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function readJsonSchemas(patterns, opt) {
|
16 | return globby.sync(patterns, opt).map(fileName => JSON.parse(fs.readFileSync(fileName, 'utf8')));
|
17 | }
|
18 | exports.readJsonSchemas = readJsonSchemas;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | function readAjvSchemas(patterns, cfg) {
|
27 | const schemas = readJsonSchemas(patterns);
|
28 | return schemas.map(schema => ajvSchema_1.AjvSchema.create(schema, {
|
29 | schemas,
|
30 | ...cfg,
|
31 | }));
|
32 | }
|
33 | exports.readAjvSchemas = readAjvSchemas;
|