Socket
Socket
Sign inDemoInstall

api-doc-validator

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-doc-validator - npm Package Compare versions

Comparing version 2.16.0 to 2.17.0

20

lib/ajvToJsDoc.js

@@ -51,4 +51,5 @@ module.exports = ajvToJsDoc;

const props = schema.properties;
const patterns = schema.patternProperties;
if (!props) {
if (!props && !patterns) {
return anyObject;

@@ -61,8 +62,17 @@ }

'{' +
Object.keys(props)
Object.keys(props || {})
.map(function (prop) {
const name = JSON.stringify(prop).replace(/^"([a-z_$][\w$]*)"$/i, '$1');
const name = normalizeProp(prop);
return `${name}${req.includes(prop) ? '' : '?'}: ${ajvToJsDoc(props[prop], params)}`;
})
.concat(
Object.keys(patterns || {})
.map(function (regex, i, list) {
const name = list.length > 1 ? 'prop' + (i + 1) : 'prop';
const type = regex === '^\\d+$' || regex === '^\\d$' ? 'number' : 'string';
return `[${name}: ${type}]: ${ajvToJsDoc(patterns[regex], params)}`;
})
)
.join(', ')

@@ -116,2 +126,6 @@ + '}'

return name.replace(/\./g, '__');
}
function normalizeProp(prop) {
return JSON.stringify(prop).replace(/^"([a-z_$][\w$]*)"$/i, '$1');
}

2

package.json
{
"name": "api-doc-validator",
"version": "2.16.0",
"version": "2.17.0",
"description": "api doc and validator",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc