diff --git a/README.md b/README.md index dd4ca05e..1ea42252 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Configure {swagger-express} as express middleware. `basePath` -> The basePath for swagger.js +`info` -> [Metadata][info] about the API + `apis` -> Define your api array. `middleware` -> Function before response. @@ -44,13 +46,20 @@ app.configure(function(){ swaggerJSON: '/api-docs.json', swaggerUI: './public/swagger/', basePath: 'http://localhost:3000', + info: { + title: 'swagger-express sample app', + description: 'Swagger + Express = {swagger-express}' + }, apis: ['./api.js', './api.yml'], middleware: function(req, res){} })); app.use(app.router); ... }); -``` +``` + +[info]: https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#513-info-object + ## Read from jsdoc Example 'api.js' diff --git a/lib/swagger-express/index.js b/lib/swagger-express/index.js index dfab0a04..b20c7a4b 100644 --- a/lib/swagger-express/index.js +++ b/lib/swagger-express/index.js @@ -235,6 +235,10 @@ function generate(opt) { descriptor.swaggerJSON = (opt.swaggerJSON) ? opt.swaggerJSON : '/api-docs.json'; descriptor.apis = []; + if(opt.info) { + descriptor.info = opt.info; + } + opt.apiVersion = descriptor.apiVersion; opt.swaggerVersion = descriptor.swaggerVersion; opt.swaggerURL = descriptor.swaggerURL;