Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cOptions.jsonRefs.filter = ['relative', 'remote'];
// Update the json-refs options to process YAML
if (_.isUndefined(cOptions.jsonRefs.loaderOptions)) {
cOptions.jsonRefs.loaderOptions = {};
}
if (_.isUndefined(cOptions.jsonRefs.loaderOptions.processContent)) {
cOptions.jsonRefs.loaderOptions.processContent = function (res, cb) {
cb(undefined, YAML.safeLoad(res.text));
};
}
// Call the appropriate json-refs API
if (_.isString(cOptions.definition)) {
return JsonRefs.resolveRefsAt(cOptions.definition, cOptions.jsonRefs);
} else {
return JsonRefs.resolveRefs(cOptions.definition, cOptions.jsonRefs);
}
})
// Resolve local references and merge results