code: function replaceRefObj (obj, resolvedValues, baseId, replaced) {
              // if found $ref key, other properties of the obj will be ignored
              if (obj.$ref) {
                  var refId = url.resolve(baseId, obj.$ref);
                  if (refId in resolvedValues) {
                      replaced[refId] = resolvedValues[refId];
                      return resolvedValues[refId];
                  }
              }
  
              _.forOwn(obj, function(val, k) {
                  if (!(val instanceof Object)) {
                      return true; //continue
                  }
  
                  var resolvedObj = replaceRefObj(val, resolvedValues, baseId, replaced);
                  if (resolvedObj) {
                      obj[k] = resolvedObj;
                  }
              });
          }
docs: replace reference in schema recursively it search the schema object and replace the $ref object with the real value example: { $ref: '#/definitions/test'} -> { type: 'string', format: 'uri'}