From f9977d66ec54f1414fcf69f3db18d923013bb36e Mon Sep 17 00:00:00 2001 From: NickOvt Date: Thu, 5 Sep 2024 10:30:32 +0300 Subject: [PATCH] fix(package-version): ZMS-160 if given version use it, otherwise use package.json version, fallback to 1.0.0 if none (#17) --- restifyOpenapiGenerator.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/restifyOpenapiGenerator.js b/restifyOpenapiGenerator.js index 3d2f557..52f83e1 100644 --- a/restifyOpenapiGenerator.js +++ b/restifyOpenapiGenerator.js @@ -228,6 +228,9 @@ class RestifyApiGenerate { ] }; + // get package version + docs.info.version = docs.info.version || require(path.join(this.dirname, 'package.json')).version || '1.0.0'; // use provided version first, if missing means use package.json version, otherwise default to first version 1.0.0 + const mapPathToMethods = {}; // map -> {path -> {post -> {}, put -> {}, delete -> {}, get -> {}}} for (const routePath in routes) {