1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
---|
4 | const core_1 = require("./core");
|
---|
5 | const draft2020_1 = require("./vocabularies/draft2020");
|
---|
6 | const discriminator_1 = require("./vocabularies/discriminator");
|
---|
7 | const json_schema_2020_12_1 = require("./refs/json-schema-2020-12");
|
---|
8 | const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
|
---|
9 | class Ajv2020 extends core_1.default {
|
---|
10 | constructor(opts = {}) {
|
---|
11 | super({
|
---|
12 | ...opts,
|
---|
13 | dynamicRef: true,
|
---|
14 | next: true,
|
---|
15 | unevaluated: true,
|
---|
16 | });
|
---|
17 | }
|
---|
18 | _addVocabularies() {
|
---|
19 | super._addVocabularies();
|
---|
20 | draft2020_1.default.forEach((v) => this.addVocabulary(v));
|
---|
21 | if (this.opts.discriminator)
|
---|
22 | this.addKeyword(discriminator_1.default);
|
---|
23 | }
|
---|
24 | _addDefaultMetaSchema() {
|
---|
25 | super._addDefaultMetaSchema();
|
---|
26 | const { $data, meta } = this.opts;
|
---|
27 | if (!meta)
|
---|
28 | return;
|
---|
29 | json_schema_2020_12_1.default.call(this, $data);
|
---|
30 | this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
---|
31 | }
|
---|
32 | defaultMeta() {
|
---|
33 | return (this.opts.defaultMeta =
|
---|
34 | super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
---|
35 | }
|
---|
36 | }
|
---|
37 | module.exports = exports = Ajv2020;
|
---|
38 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
39 | exports.default = Ajv2020;
|
---|
40 | var validate_1 = require("./compile/validate");
|
---|
41 | Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
---|
42 | var codegen_1 = require("./compile/codegen");
|
---|
43 | Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
---|
44 | Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
---|
45 | Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
---|
46 | Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
---|
47 | Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
---|
48 | Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
---|
49 | //# sourceMappingURL=2020.js.map |
---|