docs: def resolve(self, jref, parser=None):
          """ JSON reference resolver
  
          :param str jref: a JSON Reference, refer to http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 for details.
          :param parser: the parser corresponding to target object.
          :type parser: pyswagger.base.Context
          :return: the referenced object, wrapped by weakref.ProxyType
          :rtype: weakref.ProxyType
          :raises ValueError: if path is not valid
          """
  
          logger.info('resolving: [{0}]'.format(jref))
  
          if jref == None or len(jref) == 0:
              raise ValueError('Empty Path is not allowed')
  
          obj = None
          url, jp = utils.jr_split(jref)
  
          # check cacahed object against json reference by
          # comparing url first, and find those object prefixed with
          # the JSON pointer.
          o = self.__objs.get(url, None)
          if o:
              if isinstance(o, BaseObj):
                  obj = o.resolve(utils.jp_split(jp)[1:])
              elif isinstance(o, dict):
                  for k, v in six.iteritems(o):
                      if jp.startswith(k):
                          obj = v.resolve(utils.jp_split(jp[len(k):])[1:])
                          break
              else:
                  raise Exception('Unknown Cached Object: {0}'.format(str(type(o))))
  
          # this object is not found in cache
          if obj == None:
              if url:
                  obj, _ = self.load_obj(jref, parser=parser)
                  if obj:
                      obj = self.prepare_obj(obj, jref)
              else:
                  # a local reference, 'jref' is just a json-pointer
                  if not jp.startswith('#'):
                      raise ValueError('Invalid Path, root element should be \'#\', but [{0}]'.format(jref))
  
                  obj = self.root.resolve(utils.jp_split(jp)[1:]) # heading element is #, mapping to self.root
  
          if obj == None:
              raise ValueError('Unable to resolve path, [{0}]'.format(jref))
  
          if isinstance(obj, (six.string_types, six.integer_types, list, dict)):
              return obj
          return weakref.proxy(obj)