How to use the reftools/lib/jptr.jptr function in reftools

To help you get started, we’ve selected a few reftools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github APIs-guru / asyncapi-directory / index.js View on Github external
recurse(api,{},function(obj,key,state){
        if (key === 'asyncapi_servers_variables') {
            obj.variables = obj[key];
            delete obj[key];
        }
        else if (key === '$ref') {
            if (obj[key].startsWith('#/components/')) {
                const found = jptr(api,obj[key]);
                if (found === false) {
                    console.warn('Not found',obj[key]);
                    delete obj.$ref;
                }
            }
        }
    });
    return api;