refactor: update dependencies

This commit is contained in:
Rainer Killinger
2022-01-25 15:47:20 +01:00
parent 71593b44c8
commit 0b33db9f89
3 changed files with 277 additions and 285 deletions

View File

@@ -57,11 +57,11 @@ commander
// get information about routes
const routes = await gatherRouteInformation(sourcePath);
routes.sort((a, b) => a.route.urlFragment.localeCompare(b.route.urlFragment));
routes.sort((a, b) => a.route.urlPath.localeCompare(b.route.urlPath));
// change url path parameters to openapi notation
for (const routeWithMetaInformation of routes) {
routeWithMetaInformation.route.urlFragment = routeWithMetaInformation.route.urlFragment.replace(
routeWithMetaInformation.route.urlPath = routeWithMetaInformation.route.urlPath.replace(
/:\w+/g,
(match: string) => `{${match.replace(':', '')}}`,
);
@@ -69,7 +69,7 @@ commander
// keep openapi tags for routes that actually share url fragments
let tagsToKeep = routes.map(routeWithMetaInformation =>
capitalize(routeWithMetaInformation.route.urlFragment.split('/')[1]),
capitalize(routeWithMetaInformation.route.urlPath.split('/')[1]),
);
tagsToKeep = tagsToKeep.filter(
(element, i, array) => array.indexOf(element) === i && array.lastIndexOf(element) !== i,
@@ -83,9 +83,9 @@ commander
// generate documentation for all routes
for (const routeWithMetaInformation of routes) {
routeWithMetaInformation.tags = [capitalize(routeWithMetaInformation.route.urlFragment.split('/')[1])];
routeWithMetaInformation.tags = [capitalize(routeWithMetaInformation.route.urlPath.split('/')[1])];
output.paths[routeWithMetaInformation.route.urlFragment] = generateOpenAPIForRoute(
output.paths[routeWithMetaInformation.route.urlPath] = generateOpenAPIForRoute(
routeWithMetaInformation,
path.relative(relativeOutDirectoryPath, outDirectorySchemasPath),
schemasToCopy,