lib/api/JsonSchemaLib/resolveFileReferences.js
function crawl (obj, file) {
  var type = typeOf(obj);

  if (!type.isPOJO && !type.isArray) {
    return;
  }

  if (type.isPOJO && isFileReference(obj)) {
    // We found a file reference, so resolve it
    resolveFileReference(obj.$ref, file);
  }

  // Crawl this POJO or Array, looking for nested JSON References
  //
  // NOTE: According to the spec, JSON References should not have any properties other than "$ref".
  //       However, in practice, many schema authors DO add additional properties. Because of this,
  //       we crawl JSON Reference objects just like normal POJOs. If the schema author has added
  //       additional properties, then they have opted-into this non-spec-compliant behavior.
  var keys = Object.keys(obj);

  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    var value = obj[key];
    crawl(value, file);
  }
}
function crawl (obj, file) {
  var type = typeOf(obj);

  if (!type.isPOJO && !type.isArray) {
    return;
  }

  if (type.isPOJO && isFileReference(obj)) {
    // We found a file reference, so resolve it
    resolveFileReference(obj.$ref, file);
  }

  // Crawl this POJO or Array, looking for nested JSON References
  //
  // NOTE: According to the spec, JSON References should not have any properties other than "$ref".
  //       However, in practice, many schema authors DO add additional properties. Because of this,
  //       we crawl JSON Reference objects just like normal POJOs. If the schema author has added
  //       additional properties, then they have opted-into this non-spec-compliant behavior.
  var keys = Object.keys(obj);

  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    var value = obj[key];
    crawl(value, file);
  }
}
function crawl ( obj , file ) { var type = typeOf ( obj ) ; if ( ! type . isPOJO && ! type . isArray ) { return ; } if ( type . isPOJO && isFileReference ( obj ) ) { // We found a file reference, so resolve it resolveFileReference ( obj . $ref , file ) ; } // Crawl this POJO or Array, looking for nested JSON References // // NOTE: According to the spec, JSON References should not have any properties other than "$ref". //       However, in practice, many schema authors DO add additional properties. Because of this, //       we crawl JSON Reference objects just like normal POJOs. If the schema author has added //       additional properties, then they have opted-into this non-spec-compliant behavior. var keys = Object . keys ( obj ) ; for ( var i = 0 ; i < keys . length ; i ++ ) { var key = keys [ i ] ; var value = obj [ key ] ; crawl ( value , file ) ; } }
Recursively crawls the given value, and resolves any external JSON References.

@param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.
@param {File} file - The file that the value is part of
Recursively crawls the given value and resolves any external JSON References .