Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Combine the swagger specification parts into a single YAML file.
*/
var resolve = require('json-refs').resolveRefs;
var YAML = require('js-yaml');
var fs = require('fs');
process.chdir('spec');
var root = YAML.load(fs.readFileSync('root.yaml').toString());
var options = {
filter: ['relative', 'remote'],
loaderOptions: {
processContent: function (res, callback) {
callback(null, YAML.load(res.text));
}
}
};
resolve(root, options).then(function (results) {
console.log(YAML.dump(results.resolved, null, 2));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment