api-doc-validator
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -21,2 +21,3 @@ #!/usr/bin/env node | ||
.option('-b, --base-url <url>', 'default Api.baseUrl') | ||
.option('-p, --base-path <path>', 'base path for @see filename comment') | ||
.option('-e, --express <path>', 'generate express middleware validator') | ||
@@ -80,2 +81,3 @@ .option('-o, --open-api <path>', 'generate Swagger OpenAPI v3 json') | ||
resolvePath(config, program, [ | ||
'basePath', | ||
'apiClient', | ||
@@ -162,2 +164,3 @@ 'apiDts', | ||
baseUrl: config.baseUrl, | ||
basePath: config.basePath, | ||
schemas, | ||
@@ -164,0 +167,0 @@ dtsFile: config.apiDts, |
@@ -14,2 +14,3 @@ const {readFileSync, createWriteStream} = require('fs'); | ||
baseUrl = '', | ||
basePath, | ||
schemas = {}, | ||
@@ -157,5 +158,5 @@ jsdocMethods = true, | ||
const methodBase = (params) => createMethod({outputDir, endpoints, schemas, usedSchemas, ...params}); | ||
const methodBase = (params) => createMethod({basePath: basePath || outputDir, endpoints, schemas, usedSchemas, ...params}); | ||
const methodJs = (method, tag, indent = 1) => methodBase({tpl: methodTpl, method, tag, indent, generator: ajvToJsDoc}); | ||
const methodDts = (method, tag, indent = 1) => methodBase({tpl: `method = (params) => Promise<*>`, indent, method, tag, generator: ajvToDTs, any: 'any'}); | ||
const methodDts = (method, tag, indent = 1) => methodBase({tpl: `/** @see filepath */\nmethod = (params) => Promise<*>`, indent, method, tag, generator: ajvToDTs, any: 'any'}); | ||
@@ -257,3 +258,3 @@ for (const prop in ns) { | ||
function createMethod({tpl, endpoints, outputDir, indent, method, tag, schemas, generator, usedSchemas, any = '*'}) { | ||
function createMethod({tpl, endpoints, basePath, indent, method, tag, schemas, generator, usedSchemas, any = '*'}) { | ||
const n = tag.match(/\d+$/)[0]; | ||
@@ -273,3 +274,3 @@ const e = endpoints[n]; | ||
return relative(outputDir, e.file) + (e.line ? ':' + e.line : ''); | ||
return relative(basePath, e.file) + (e.line ? ':' + e.line : ''); | ||
@@ -276,0 +277,0 @@ case 'function(params)': |
{ | ||
"name": "api-doc-validator", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"description": "api doc and validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -362,2 +362,3 @@ # api ➡️ doc ➡️ validator | ||
-b, --base-url <url> default Api.baseUrl | ||
-p, --base-path <path> base path for @see filename comment | ||
-e, --express <path> generate express middleware validator | ||
@@ -559,2 +560,3 @@ -o, --open-api <path> generate Swagger OpenAPI v3 json | ||
* `apiDts` same as `--api-dts <path>` | ||
* `basePath` same as `--base-path <path>` | ||
* `json` same as `--json <path>` | ||
@@ -561,0 +563,0 @@ * `express` same as `--express <path>` |
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
59437
1661
583