_util.js 402 B

123456789101112131415
  1. 'use strict';
  2. module.exports = {
  3. metaSchemaRef: metaSchemaRef
  4. };
  5. var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
  6. function metaSchemaRef(ajv) {
  7. var defaultMeta = ajv._opts.defaultMeta;
  8. if (typeof defaultMeta == 'string') return { $ref: defaultMeta };
  9. if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID };
  10. console.warn('meta schema not defined');
  11. return {};
  12. }