api-doc-validator
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -9,3 +9,3 @@ #!/usr/bin/env node | ||
const filesToEndpoints = require('./lib/filesToEndpoints'); | ||
const {generateAjvSchema} = require('./lib/parseSchema'); | ||
const {generateAjvSchema, getProp} = require('./lib/parseSchema'); | ||
const generateApiClient = require('./lib/generate/apiClient'); | ||
@@ -24,2 +24,3 @@ const generateExpressMiddleware = require('./lib/generate/expressMiddleware'); | ||
.option('-R, --jsdoc-refs <boolean>', 'use references to jsdoc @typedef or replace them with reference body, default true') | ||
.option('-P, --extra-props <boolean>', 'value for ajv "object" additionalProperties, default false') | ||
; | ||
@@ -54,2 +55,3 @@ | ||
'jsdocTypedefs', | ||
'extraProps', | ||
]); | ||
@@ -72,2 +74,7 @@ | ||
var defaultSchemas = getDefaultSchemas(); | ||
if (typeof config.extraProps === 'boolean') { | ||
getProp(defaultSchemas.object, 'additionalProperties').value.value = config.extraProps; | ||
} | ||
var cache = {...defaultSchemas}; | ||
@@ -74,0 +81,0 @@ |
@@ -6,2 +6,6 @@ const t = require('@babel/types'); | ||
function getObjectName(root) { | ||
if (t.isNullLiteral(root)) { | ||
return 'null'; | ||
} | ||
if (t.isBinaryExpression(root)) { | ||
@@ -8,0 +12,0 @@ return minusExpressionToObjectName(root); |
@@ -24,2 +24,3 @@ const t = require('@babel/types'); | ||
module.exports.resetCache = resetCache; | ||
module.exports.getProp = getProp; | ||
@@ -72,3 +73,3 @@ function parseSchema(code) { | ||
} | ||
else if (t.isIdentifier(root) || t.isMemberExpression(root) || t.isBinaryExpression(root)) { | ||
else if (t.isIdentifier(root) || t.isMemberExpression(root) || t.isBinaryExpression(root) || t.isNullLiteral(root)) { | ||
return astObjectNameToAjvSchema(root); | ||
@@ -75,0 +76,0 @@ } |
@@ -8,2 +8,3 @@ const toAst = require('../toAst'); | ||
return { | ||
null: require('./null'), | ||
object: require('./object'), | ||
@@ -10,0 +11,0 @@ string: require('./string'), |
{ | ||
"name": "api-doc-validator", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "api doc and validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -726,2 +726,3 @@ # api ➡️ doc ➡️ validator | ||
-R, --jsdoc-refs <boolean> use references to jsdoc @typedef or replace them with reference body, default true | ||
-P, --extra-props <boolean> value for ajv "object" additionalProperties, default false | ||
``` | ||
@@ -900,3 +901,4 @@ | ||
* `express` same as `--express <path>` | ||
* `namespace` same as `--namespace <path>` | ||
* `namespace` same as `--namespace <namespace>` | ||
* `extraProps` same as `--extra-props <boolean>` | ||
@@ -903,0 +905,0 @@ All paths are relative to config file location. |
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
65376
58
1597
919