express-swagger-generator
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -65,8 +65,37 @@ /** | ||
function parseSchema(obj) { | ||
if (!obj.name) return undefined; | ||
const spl = obj.name.split('.'); | ||
if (spl.length > 1 && spl[1] == 'model') { | ||
return {"$ref": "#/definitions/" + spl[0]}; | ||
if (!(obj.name || obj.applications)) return undefined; | ||
if (obj.name) { | ||
const spl = obj.name.split('.'); | ||
if (spl.length > 1 && spl[1] == 'model') { | ||
return {"$ref": "#/definitions/" + spl[0]}; | ||
} | ||
else return undefined; | ||
} | ||
else return undefined; | ||
if (obj.applications) { | ||
if (obj.applications.length === 1) { | ||
return { | ||
type: obj.expression.name.toLowerCase(), | ||
items: { | ||
"$ref": "#/definitions/" + obj.applications[0].name | ||
} | ||
} | ||
} | ||
let oneOf = [] | ||
for (let i in obj.applications) { | ||
oneOf.push({ | ||
"$ref": "#/definitions/" + obj.applications[i].name | ||
}) | ||
} | ||
return { | ||
type: obj.expression.name.toLowerCase(), | ||
items: { | ||
oneOf: oneOf | ||
} | ||
} | ||
} | ||
return undefined | ||
} | ||
@@ -92,4 +121,5 @@ | ||
let description = tags[i]['description'].split("-"), key = description[0].trim() | ||
rets[key] = { | ||
description: description[1].trim(), | ||
description: description[1] ? description[1].trim() : '', | ||
headers: headers[key] | ||
@@ -96,0 +126,0 @@ }; |
{ | ||
"name": "express-swagger-generator", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Generates swagger doc & ui based on express existing routes.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,2 +104,3 @@ ### Express Swagger Generator | ||
* @returns {Product.model} default - Unexpected error | ||
* @returns {Array.<Point>} Point - Some description for point | ||
* @headers {integer} 200.X-Rate-Limit - calls per hour allowed by the user | ||
@@ -106,0 +107,0 @@ * @headers {string} 200.X-Expires-After - date in UTC when token expires |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25725
6
634
113