ajv.js 862 B

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