MCPcopy
hub / github.com/Kong/insomnia / resolve

Function resolve

packages/insomnia/bin/yarn-standalone.js:46767–46799  ·  view source on GitHub ↗

* [resolve and compile the references ($ref)] * @this Ajv * @param {Function} compile reference to schema compilation funciton (localCompile) * @param {Object} root object with information about the root schema for the current schema * @param {String} ref reference to resolve * @return {Ob

(compile, root, ref)

Source from the content-addressed store, hash-verified

46765 * @return {Object|Function} schema object (if the schema can be inlined) or validation function
46766 */
46767function resolve(compile, root, ref) {
46768 /* jshint validthis: true */
46769 var refVal = this._refs[ref];
46770 if (typeof refVal == 'string') {
46771 if (this._refs[refVal]) refVal = this._refs[refVal];
46772 else return resolve.call(this, compile, root, refVal);
46773 }
46774
46775 refVal = refVal || this._schemas[ref];
46776 if (refVal instanceof SchemaObject) {
46777 return inlineRef(refVal.schema, this._opts.inlineRefs)
46778 ? refVal.schema
46779 : refVal.validate || this._compile(refVal);
46780 }
46781
46782 var res = resolveSchema.call(this, root, ref);
46783 var schema, v, baseId;
46784 if (res) {
46785 schema = res.schema;
46786 root = res.root;
46787 baseId = res.baseId;
46788 }
46789
46790 if (schema instanceof SchemaObject) {
46791 v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
46792 } else if (schema !== undefined) {
46793 v = inlineRef(schema, this._opts.inlineRefs)
46794 ? schema
46795 : compile.call(this, schema, root, undefined, baseId);
46796 }
46797
46798 return v;
46799}
46800
46801
46802/**

Callers 15

addScriptCommandFunction · 0.85
util.test.tsFile · 0.85
verifyPkgFunction · 0.85
artifactsFunction · 0.85
neDbAdapterFunction · 0.85
runInternalFunction · 0.85
generateToFileFunction · 0.85
storeTimelineFunction · 0.85
cancellablePromiseFunction · 0.85
authorizeUserInWindowFunction · 0.85
install-plugin.tsFile · 0.85
_isInsomniaPluginFunction · 0.85

Calls 1

inlineRefFunction · 0.85

Tested by

no test coverage detected