Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function enrichSchema(schema){
for(var path in schema.paths){
for(var method in schema.paths[path]){
var generatedCode = OpenAPISnippet.getEndpointSnippets(schema, path, method, targets);
schema.paths[path][method]["x-code-samples"] = [];
for(var snippetIdx in generatedCode.snippets){
var snippet = generatedCode.snippets[snippetIdx];
schema.paths[path][method]["x-code-samples"][snippetIdx] = { "lang": snippet.title, "source": snippet.content };
}
}
}
return schema;
}