MCPcopy
hub / github.com/ajv-validator/ajv / constructor

Method constructor

lib/core.ts:294–315  ·  view source on GitHub ↗
(opts: Options = {})

Source from the content-addressed store, hash-verified

292 static MissingRefError = MissingRefError
293
294 constructor(opts: Options = {}) {
295 opts = this.opts = {...opts, ...requiredOptions(opts)}
296 const {es5, lines} = this.opts.code
297
298 this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines})
299 this.logger = getLogger(opts.logger)
300 const formatOpt = opts.validateFormats
301 opts.validateFormats = false
302
303 this.RULES = getRules()
304 checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED")
305 checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn")
306 this._metaOpts = getMetaSchemaOptions.call(this)
307
308 if (opts.formats) addInitialFormats.call(this)
309 this._addVocabularies()
310 this._addDefaultMetaSchema()
311 if (opts.keywords) addInitialKeywords.call(this, opts.keywords)
312 if (typeof opts.meta == "object") this.addMetaSchema(opts.meta)
313 addInitialSchemas.call(this)
314 opts.validateFormats = formatOpt
315 }
316
317 _addVocabularies(): void {
318 this.addKeyword("$async")

Callers

nothing calls this directly

Calls 6

_addVocabulariesMethod · 0.95
_addDefaultMetaSchemaMethod · 0.95
addMetaSchemaMethod · 0.95
getRulesFunction · 0.90
requiredOptionsFunction · 0.85
getLoggerFunction · 0.70

Tested by

no test coverage detected