UNPKG

2.78 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
4const core_1 = require("./core");
5const draft7_1 = require("./vocabularies/draft7");
6const discriminator_1 = require("./vocabularies/discriminator");
7const draft7MetaSchema = require("./refs/json-schema-draft-07.json");
8const META_SUPPORT_DATA = ["/properties"];
9const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
10class Ajv extends core_1.default {
11 _addVocabularies() {
12 super._addVocabularies();
13 draft7_1.default.forEach((v) => this.addVocabulary(v));
14 if (this.opts.discriminator)
15 this.addKeyword(discriminator_1.default);
16 }
17 _addDefaultMetaSchema() {
18 super._addDefaultMetaSchema();
19 if (!this.opts.meta)
20 return;
21 const metaSchema = this.opts.$data
22 ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)
23 : draft7MetaSchema;
24 this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
25 this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
26 }
27 defaultMeta() {
28 return (this.opts.defaultMeta =
29 super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
30 }
31}
32module.exports = exports = Ajv;
33Object.defineProperty(exports, "__esModule", { value: true });
34exports.default = Ajv;
35var validate_1 = require("./compile/validate");
36Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
37var codegen_1 = require("./compile/codegen");
38Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
39Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
40Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
41Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
42Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
43Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
44var validation_error_1 = require("./runtime/validation_error");
45Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
46var ref_error_1 = require("./compile/ref_error");
47Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
48//# sourceMappingURL=ajv.js.map
\No newline at end of file