Skip to content

Commit

Permalink
Add options validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Cheung committed Jun 3, 2015
1 parent 33a1f98 commit 95bd90f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
35 changes: 35 additions & 0 deletions lib/swagger-express/newIndex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@


var swaggerObject = {};

module.exports.init = function (app, options) {
if (!options) {
throw new Error('\'options\' is required.');
}
else if (!options.swaggerJsonPath) {
throw new Error('\'swaggerJsonPath\' is required.');
}
else if (!options.swaggerUiDir) {
throw new Error('\'swaggerUiDir\' is required.');
}
else if (!options.swaggerUiPath) {
throw new Error('\'swaggerUiPath\' is required.');
}
else if (!options.info) {
throw new Error('\'info\' is required.');
}
else if (!options.info.title) {
throw new Error('\'title\' is required.');
}
else if (!options.info.version) {
throw new Error('\'version\' is required.');
}
else if (!options.apis) {
throw new Error('\'apis\' is required.');
}



// Attach to Express routes.

};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"async": "^1.2.0",
"coffee-script": "^1.9.3",
"doctrine": "^0.6.4",
"express": "^4.12.4",
"js-yaml": "^3.3.1",
"underscore": "^1.8.3"
},
"devDependencies": {
"eslint": "^0.22.1",
"express": "^4.12.4",
"jade": "^1.10.0"
}
}

0 comments on commit 95bd90f

Please sign in to comment.