Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;