Urara-Blog/node_modules/.pnpm-store/v3/files/26/0e4b5ba000250fbec7c613567705f196f23ce5214dee1b4801e91bcc14fcce6d1821f3fc5afd03066cdb7caaec49bb75d8ca92e5d8154d346eb7d745937a36
2022-08-14 01:14:53 +08:00

34 lines
993 B
Text

/**
* @fileoverview The instance of Ajv validator.
* @author Evgeny Poberezkin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const Ajv = require("ajv"),
metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = (additionalOptions = {}) => {
const ajv = new Ajv({
meta: false,
useDefaults: true,
validateSchema: false,
missingRefs: "ignore",
verbose: true,
schemaId: "auto",
...additionalOptions
});
ajv.addMetaSchema(metaSchema);
// eslint-disable-next-line no-underscore-dangle -- Ajv's API
ajv._opts.defaultMeta = metaSchema.id;
return ajv;
};