express-jsdoc-swagger
Advanced tools
Comparing version 1.6.7 to 1.6.8
@@ -31,4 +31,8 @@ { | ||
"jest/prefer-to-have-length": "warn", | ||
"jest/valid-expect": "error" | ||
"jest/valid-expect": "error", | ||
"max-len": ["error", { | ||
"ignoreComments": true, | ||
"code": 130 | ||
}] | ||
} | ||
} |
{ | ||
"name": "express-jsdoc-swagger", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"description": "Swagger OpenAPI 3.x generator", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"merge": "^2.1.1", | ||
"swagger-ui-express": "^4.1.6" | ||
"swagger-ui-express": "^4.3.0" | ||
}, | ||
@@ -15,0 +15,0 @@ "devDependencies": { |
@@ -324,3 +324,7 @@  | ||
<td align="center"><a href="https://github.com/gandazgul"><img src="https://avatars.githubusercontent.com/u/108850?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Carlos Ravelo</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=gandazgul" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/paulish"><img src="https://avatars.githubusercontent.com/u/1762032?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Ishenin</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=paulish" title="Code">💻</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/sbingner"><img src="https://avatars.githubusercontent.com/u/354533?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sam Bingner</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=sbingner" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
@@ -327,0 +331,0 @@ |
@@ -71,2 +71,4 @@ const { getTagInfo, getTagsInfo } = require('../utils/tags'); | ||
const requiredProperties = getRequiredProperties(propertyValues); | ||
const [descriptionValue, enumValues, jsonOptions] = formatDescription(schema.description); | ||
const [description, format] = mapDescription(descriptionValue); | ||
if (!typedef || !typedef.name) return {}; | ||
@@ -76,11 +78,17 @@ const { | ||
} = typedef.type; | ||
const type = typedef.type.name || 'object'; | ||
return { | ||
[typedef.name]: { | ||
...combineSchema(elements), | ||
description: schema.description, | ||
description, | ||
...(requiredProperties.length ? { | ||
required: formatRequiredProperties(requiredProperties), | ||
} : {}), | ||
type: 'object', | ||
properties: formatProperties(propertyValues, options), | ||
type, | ||
...(type === 'object' ? { | ||
properties: formatProperties(propertyValues, options), | ||
} : {}), | ||
...(format ? { format } : {}), | ||
...addEnumValues(enumValues), | ||
...(jsonOptions || {}), | ||
}, | ||
@@ -87,0 +95,0 @@ }; |
@@ -9,2 +9,4 @@ const errorMessage = require('../utils/errorMessage'); | ||
const DEPRECATED = 'deprecated'; | ||
const EXPLODE = 'explode'; | ||
const NOEXPLODE = 'noexplode'; | ||
const BODY_PARAM = 'body'; | ||
@@ -36,2 +38,5 @@ const FORM_TYPE = 'form'; | ||
}), | ||
explode: setProperty(options, 'explode', { | ||
type: 'boolean', | ||
}), | ||
schema, | ||
@@ -57,2 +62,4 @@ }); | ||
const isDeprecated = extraOptions.includes(DEPRECATED); | ||
const shouldExplode = extraOptions.includes(EXPLODE); | ||
const shouldNotExplode = extraOptions.includes(NOEXPLODE); | ||
const [description, enumValues, jsonOptions] = formatDescription(param.description); | ||
@@ -66,2 +73,8 @@ const options = { | ||
}; | ||
// Used this format because default when undefined is different depending on if it is a query/form or not | ||
if (shouldExplode) { | ||
options.explode = true; | ||
} else if (shouldNotExplode) { | ||
options.explode = false; | ||
} | ||
const schema = getSchema('@param', param.name)(param.type, enumValues, jsonOptions); | ||
@@ -68,0 +81,0 @@ return parameterPayload(options, schema); |
@@ -15,3 +15,5 @@ const errorMessage = require('./errorMessage'); | ||
} catch (err) { | ||
const message = type === 'requestBody' ? 'requestBody example malformed' : `response example for status ${status} with content-type ${DEFAULT_CONTENT_TYPE} malformed`; | ||
const message = type === 'requestBody' | ||
? 'requestBody example malformed' | ||
: `response example for status ${status} with content-type ${DEFAULT_CONTENT_TYPE} malformed`; | ||
errorMessage(message); | ||
@@ -18,0 +20,0 @@ } |
const errorMessage = require('./errorMessage'); | ||
const setProperty = entity => { | ||
const requiredError = (key, item) => new Error(`Key ${key} is required in item ${JSON.stringify(item)} for Entity ${entity}`); | ||
const requiredError = (key, item) => ( | ||
new Error(`Key ${key} is required in item ${JSON.stringify(item)} for Entity ${entity}`) | ||
); | ||
const warnType = (type, value) => errorMessage(`${type} is not valid with value ${value} for Entity ${entity}`); | ||
const warnType = (type, value) => ( | ||
errorMessage(`${type} is not valid with value ${value} for Entity ${entity}`) | ||
); | ||
@@ -8,0 +12,0 @@ return (item, key, options) => { |
Sorry, the diff of this file is not supported yet
75247
1390
337
Updatedswagger-ui-express@^4.3.0