def resolve(self, jref, parser=None):

        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)
        if url:
            # 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 loaded yet, load it
            if obj == None:
                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)
JSON reference resolver
dataset/ETHPy150Open mission-liao/pyswagger/pyswagger/core.py/SwaggerApp.resolve