Skip to content

Commit

Permalink
Fix listing problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Cheung committed Jun 4, 2015
1 parent 0ba898b commit 00f3be7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/swagger-express/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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));
Expand Down

0 comments on commit 00f3be7

Please sign in to comment.