api-doc-validator
Advanced tools
Comparing version 2.7.3 to 2.7.4
@@ -44,3 +44,3 @@ module.exports = ajvToJsDoc; | ||
if (type === 'object') { | ||
let props = schema.properties; | ||
const props = schema.properties; | ||
@@ -51,9 +51,15 @@ if (!props) { | ||
var req = schema.required || []; | ||
const req = schema.required || []; | ||
props = Object.keys(props).map(function (prop) { | ||
return `"${prop}"${req.includes(prop) ? '' : '?'}: ${ajvToJsDoc(props[prop], params)}`; | ||
}); | ||
return ( | ||
'{' + | ||
Object.keys(props) | ||
.map(function (prop) { | ||
const name = JSON.stringify(prop).replace(/^"([a-z_$][\w$]*)"$/i, '$1'); | ||
return `{${props.join(', ')}}`; | ||
return `${name}${req.includes(prop) ? '' : '?'}: ${ajvToJsDoc(props[prop], params)}`; | ||
}) | ||
.join(', ') | ||
+ '}' | ||
); | ||
} | ||
@@ -60,0 +66,0 @@ |
@@ -181,3 +181,3 @@ const {readFileSync, createWriteStream} = require('fs'); | ||
`\tthis.${prop} = ${namespace};\n`.replace(/^(\t*)("[^"]+":) "(endpoint-\d+)"/gm, function (x, t, method, tag) { | ||
return methodJs(method, tag, t.length); | ||
return methodJs(method.replace(/^"([a-z_$][\w$]*)":$/i, '$1:'), tag, t.length); | ||
}) | ||
@@ -189,3 +189,3 @@ ); | ||
`\t${prop}: ${namespace},\n`.replace(/^(\t*)("[^"]+":) "(endpoint-\d+)"/gm, function (x, t, method, tag) { | ||
return methodDts(method, tag, t.length); | ||
return methodDts(method.replace(/^"([a-z_$][\w$]*)":$/i, '$1:'), tag, t.length); | ||
}) | ||
@@ -254,3 +254,3 @@ ); | ||
return value; | ||
}); | ||
}).replace(/"([$\w]+)":/g, '$1:'); | ||
} | ||
@@ -257,0 +257,0 @@ |
{ | ||
"name": "api-doc-validator", | ||
"version": "2.7.3", | ||
"version": "2.7.4", | ||
"description": "api doc and validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
58545
1640