lib/json_schema.js
function(reference, callback) {
    var url = reference.url;
    var uri = reference.uri;
    var schema = reference.schema;

    // Execute the request
    request(url, function(error, response, body) {
      // We have an error
      if(error) return callback(error);
      // Got the body, parse it
      var obj = JSON.parse(body);

      // Resolve the object
      explode(obj, function(err, obj) {
        if(err) return callback(err);

        // Split the url out to locate the right place
        var path = url.substr(url.indexOf('#'));

        // Locate the actual document we want
        var pathObj = resolve(path, obj);

        // Replace the node
        delete schema['$ref'];
        for(var name in pathObj) {
          schema[name] = pathObj[name];
        }

        // Return the result
        callback();
      })
    });
  }
function(reference, callback) {
    var url = reference.url;
    var uri = reference.uri;
    var schema = reference.schema;

    // Execute the request
    request(url, function(error, response, body) {
      // We have an error
      if(error) return callback(error);
      // Got the body, parse it
      var obj = JSON.parse(body);

      // Resolve the object
      explode(obj, function(err, obj) {
        if(err) return callback(err);

        // Split the url out to locate the right place
        var path = url.substr(url.indexOf('#'));

        // Locate the actual document we want
        var pathObj = resolve(path, obj);

        // Replace the node
        delete schema['$ref'];
        for(var name in pathObj) {
          schema[name] = pathObj[name];
        }

        // Return the result
        callback();
      })
    });
  }
function ( reference , callback ) { var url = reference . url ; var uri = reference . uri ; var schema = reference . schema ; // Execute the request request ( url , function ( error , response , body ) { // We have an error if ( error ) return callback ( error ) ; // Got the body, parse it var obj = JSON . parse ( body ) ; // Resolve the object explode ( obj , function ( err , obj ) { if ( err ) return callback ( err ) ; // Split the url out to locate the right place var path = url . substr ( url . indexOf ( '#' ) ) ; // Locate the actual document we want var pathObj = resolve ( path , obj ) ; // Replace the node delete schema [ '$ref' ] ; for ( var name in pathObj ) { schema [ name ] = pathObj [ name ] ; } // Return the result callback ( ) ; } ) } ) ; }
Grab the url
Grab the url