api-doc-validator
Advanced tools
Comparing version 2.7.4 to 2.7.5
@@ -18,5 +18,9 @@ module.exports = ajvToJsDoc; | ||
if (type === 'string' || type === 'number') { | ||
if (!schema.enum) return type; | ||
return !schema.enum ? type : schema.enum.map(v => JSON.stringify(v)).join('|'); | ||
return ( | ||
schema.hasOwnProperty('const') ? | ||
JSON.stringify(schema.const) : | ||
schema.enum ? | ||
schema.enum.map(v => JSON.stringify(v)).join('|') : | ||
type | ||
); | ||
} | ||
@@ -66,4 +70,13 @@ | ||
var {anyOf, allOf} = schema; | ||
const {anyOf, allOf} = schema; | ||
const types = ['string', 'number', 'integer']; | ||
if (anyOf && anyOf.every(item => types.includes(item.type) && item.enum || item.type === 'null')) { | ||
return anyOf.reduce((list, item) => { | ||
list.push(ajvToJsDoc(item, params)); | ||
return list; | ||
}, []).join('|'); | ||
} | ||
if (jsDocNull && anyOf && anyOf.length === 2 && anyOf.some(item => item.type === 'null')) { | ||
@@ -70,0 +83,0 @@ return '?' + ajvToJsDoc(anyOf.find(item => item.type !== 'null')); |
{ | ||
"name": "api-doc-validator", | ||
"version": "2.7.4", | ||
"version": "2.7.5", | ||
"description": "api doc and validator", | ||
@@ -32,3 +32,3 @@ "main": "index.js", | ||
"@babel/types": "^7.18.10", | ||
"adv-parser": "^2.2.0", | ||
"adv-parser": "^2.3.1", | ||
"commander": "^5.1.0", | ||
@@ -35,0 +35,0 @@ "glob": "^7.2.3", |
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
58870
1652
Updatedadv-parser@^2.3.1