description and source-codefunction swaggerize(options) {
var app;
assert.ok(thing.isObject(options), 'Expected options to be an object.');
assert.ok(options.api, 'Expected an api definition.');
if (thing.isString(options.api)) {
options.api = loadApi(options.api);
}
options.express = options.express || {};
options.basedir = options.basedir || path.dirname(caller());
assert.ok(!options.express || thing.isObject(options.express), 'Expected express options to be an object.');
assert.ok(thing.isObject(options.api), 'Api definition must resolve to an object.');
options.routes = routes(options);
app = express();
app.once('mount', mount(app, options));
return app;
}