@egodigital/express-controllers
Advanced tools
# Change Log (@egodigital/express-controllers) | ||
## 4.2.0 | ||
* improvements | ||
## 4.1.5 | ||
@@ -4,0 +8,0 @@ |
@@ -172,16 +172,18 @@ "use strict"; | ||
// path definitions | ||
for (const SI of infos) { | ||
for (const ROUTE_PATH in SI.groupedRouterMethods) { | ||
const SWAGGER_PATH = toSwaggerPath(ROUTE_PATH); | ||
infos.forEach(si => { | ||
Object.keys(si.groupedRouterMethods).sort((x, y) => { | ||
return utils_1.compareValuesBy(x, y, routePath => { | ||
return utils_1.normalizeString(routePath); // keep sure to display paths in alphabetic order | ||
}); | ||
}).forEach(routePath => { | ||
const SWAGGER_PATH = toSwaggerPath(routePath); | ||
if (_.isNil(newSwaggerDoc.paths[SWAGGER_PATH])) { | ||
newSwaggerDoc.paths[SWAGGER_PATH] = {}; | ||
} | ||
const ALL_METHODS = SI.groupedRouterMethods[ROUTE_PATH] | ||
.sort(); | ||
// set for each method | ||
for (const METHOD of ALL_METHODS) { | ||
let pathDefinition = SI.pathDefinition; | ||
si.groupedRouterMethods[routePath].sort().forEach(m => { | ||
let pathDefinition = si.pathDefinition; | ||
let pathDefinitionUpdater; | ||
if (SI.options) { | ||
pathDefinitionUpdater = SI.options.pathDefinitionUpdater; | ||
if (si.options) { | ||
pathDefinitionUpdater = si.options.pathDefinitionUpdater; | ||
} | ||
@@ -194,5 +196,5 @@ if (_.isNil(pathDefinitionUpdater)) { | ||
definition: pathDefinition, | ||
hasAuthorize: !_.isNil(SI.controllerMethod[authorize_1.AUTHORIZER_OPTIONS]), | ||
method: METHOD.toUpperCase(), | ||
path: ROUTE_PATH, | ||
hasAuthorize: !_.isNil(si.controllerMethod[authorize_1.AUTHORIZER_OPTIONS]), | ||
method: m.toUpperCase(), | ||
path: routePath, | ||
}; | ||
@@ -203,7 +205,7 @@ pathDefinitionUpdater(UPDATER_CTX); | ||
if (pathDefinition) { | ||
newSwaggerDoc.paths[SWAGGER_PATH][METHOD] = pathDefinition; | ||
newSwaggerDoc.paths[SWAGGER_PATH][m] = pathDefinition; | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
@@ -210,0 +212,0 @@ const ROUTER = express.Router(); |
{ | ||
"name": "@egodigital/express-controllers", | ||
"version": "4.1.5", | ||
"version": "4.2.0", | ||
"description": "Sets up controllers for Express framework.", | ||
@@ -5,0 +5,0 @@ "author": "e.GO Digital GmbH, Aachen, Germany", |
115815
0.15%2644
0.08%