From 00f3be7c554f0fd4a09841ba4b9e4df3a5d6b296 Mon Sep 17 00:00:00 2001 From: Louis Cheung Date: Thu, 4 Jun 2015 16:27:48 -0400 Subject: [PATCH] Fix listing problems --- lib/swagger-express/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/swagger-express/index.js b/lib/swagger-express/index.js index feb89edd..d8ce64dd 100644 --- a/lib/swagger-express/index.js +++ b/lib/swagger-express/index.js @@ -56,7 +56,7 @@ module.exports.init = function (app, options) { app.use(options.swaggerUiPath, express.static(options.swaggerUiDir)); }; -// --------------------------------------------------------------------------------------------------------------------- +// -- Parsing ---------------------------------------------------------------------------------------------------------- /** * Parses the provided API file and attaches the fields to the Swagger object. @@ -69,10 +69,12 @@ function parseApiFile(file) { } else if (fileExtension === '.yml') { // parseYml(file); + // TODO: Support YAML throw new Error('Unsupported extension \'' + fileExtension + '\'.'); } else if (fileExtension === '.coffee') { // parseCoffee(file); + // TODO: Support CoffeeScript throw new Error('Unsupported extension \'' + fileExtension + '\'.'); } else { @@ -103,7 +105,7 @@ function parseJsDoc(file) { * @param {string} sourceCode - Source code to parse * @returns {array} */ -function parseJsDocComments(sourceCode) { +function parseJsDocComments(jsSourceCode) { var jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm; var fragments = jsSourceCode.match(jsDocRegex); var jsDocs = []; @@ -127,9 +129,9 @@ function parseJsDocComments(sourceCode) { */ function filterSwaggerTags(jsDocs) { var swaggerJsDocs = []; - for (int i = 0; i < jsDocs.length; i++) { + for (var i = 0; i < jsDocs.length; i++) { var jsDoc = jsDocs[i]; - for (int j = 0; j < jsDoc.tags.length; j++) { + for (var j = 0; j < jsDoc.tags.length; j++) { var tag = jsDoc.tags[j]; if (tag.title === 'swagger') { swaggerJsDocs.push(jsYaml.safeLoad(tag.description));