UNPKG

862 BJavaScriptView Raw
1/**
2 * @fileoverview The instance of Ajv validator.
3 * @author Evgeny Poberezkin
4 */
5"use strict";
6
7//------------------------------------------------------------------------------
8// Requirements
9//------------------------------------------------------------------------------
10
11const Ajv = require("ajv"),
12 metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
13
14//------------------------------------------------------------------------------
15// Public Interface
16//------------------------------------------------------------------------------
17
18const ajv = new Ajv({
19 meta: false,
20 useDefaults: true,
21 validateSchema: false,
22 missingRefs: "ignore",
23 verbose: true,
24 schemaId: "auto"
25});
26
27ajv.addMetaSchema(metaSchema);
28// eslint-disable-next-line no-underscore-dangle
29ajv._opts.defaultMeta = metaSchema.id;
30
31module.exports = ajv;