express-jsdoc-swagger
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -32,5 +32,16 @@ // Type definitions for express-jsdoc-swagger | ||
interface SecurityObject { | ||
name: string[]; | ||
type: string; | ||
scheme: string; | ||
} | ||
interface Security { | ||
[key: string]: SecurityObject; | ||
} | ||
interface Servers { | ||
url: string; | ||
description: string; | ||
variables?: object; | ||
} | ||
interface Options { | ||
@@ -40,4 +51,4 @@ info: InfoObject; | ||
filesPattern: string | string[]; | ||
security?: SecurityObject[]; | ||
servers?: string[]; | ||
security?: Security; | ||
servers?: string[] | Servers[]; | ||
exposeSwaggerUI?: boolean; | ||
@@ -44,0 +55,0 @@ swaggerUIPath?: string; |
{ | ||
"name": "express-jsdoc-swagger", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Swagger OpenAPI 3.x generator", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"merge": "^2.1.0", | ||
"swagger-ui-express": "^4.1.5" | ||
"swagger-ui-express": "^4.1.6" | ||
}, | ||
@@ -15,0 +15,0 @@ "devDependencies": { |
@@ -5,2 +5,3 @@ const setProperty = require('../utils/setProperty')('parameter'); | ||
const formParams = require('./formParams'); | ||
const formatExampleValues = require('../utils/formatExamples')('requestBody'); | ||
@@ -31,4 +32,8 @@ const REQUIRED = 'required'; | ||
const examplesParsed = examples.map(example => ( | ||
formatExampleValues(example, contentType) | ||
)); | ||
if (hasForm) { | ||
return formParams(currentState, name, body, isRequired, checkExamples(examples)); | ||
return formParams(currentState, name, body, isRequired, checkExamples(examplesParsed)); | ||
} | ||
@@ -47,3 +52,3 @@ | ||
...currentState.content, | ||
...getContent(body.type, contentType, body.description, checkExamples(examples)), | ||
...getContent(body.type, contentType, body.description, checkExamples(examplesParsed)), | ||
}, | ||
@@ -50,0 +55,0 @@ }; |
@@ -5,2 +5,3 @@ const errorMessage = require('../utils/errorMessage'); | ||
const getContent = require('./content')('@return'); | ||
const formatExampleValues = require('../utils/formatExamples')('responses'); | ||
@@ -18,14 +19,7 @@ const DEFAULT_CONTENT_TYPE = 'application/json'; | ||
const exampleList = examples[status]; | ||
if (exampleList && (contentType === DEFAULT_CONTENT_TYPE || !contentType)) { | ||
Object.keys(exampleList) | ||
.filter(k => typeof exampleList[k].value === 'string') | ||
.forEach(k => { | ||
try { | ||
exampleList[k].value = JSON.parse(exampleList[k].value); | ||
} catch (err) { | ||
errorMessage(`response example for status ${status} with content-type ${contentType} malformed`); | ||
} | ||
}); | ||
} | ||
const exampleList = formatExampleValues( | ||
examples[status], | ||
contentType || DEFAULT_CONTENT_TYPE, | ||
status, | ||
); | ||
@@ -32,0 +26,0 @@ return { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
0
100
0
60934
55
1187
Updatedswagger-ui-express@^4.1.6