From f9f28f245e4e95738731d160323a83767d45c3c5 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 8 Feb 2023 16:38:22 +0530 Subject: [PATCH] fix: wrap await call Signed-off-by: Pranav C --- .../src/lib/v1-legacy/rest/RestApiBuilder.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts index b1bd8a261e..4ed70240ac 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts @@ -2649,7 +2649,8 @@ export class RestApiBuilder extends BaseApiBuilder { scheme, scheme === 'http' ? 'https' : 'http', ]; - await promisify(glob)( + ( + await promisify(glob)( path.join( this.app.getToolDir(), 'nc', @@ -2659,15 +2660,14 @@ export class RestApiBuilder extends BaseApiBuilder { 'swagger.json' ) ) - .forEach(async (jsonFile) => { - const swaggerJson = JSON.parse(await promisify(fs.readFile)(jsonFile, 'utf8')); - swaggerBaseDocument.tags.push(...swaggerJson.tags); - Object.assign(swaggerBaseDocument.paths, swaggerJson.paths); - Object.assign( - swaggerBaseDocument.definitions, - swaggerJson.definitions - ); - }); + ).forEach(async (jsonFile) => { + const swaggerJson = JSON.parse( + await promisify(fs.readFile)(jsonFile, 'utf8') + ); + swaggerBaseDocument.tags.push(...swaggerJson.tags); + Object.assign(swaggerBaseDocument.paths, swaggerJson.paths); + Object.assign(swaggerBaseDocument.definitions, swaggerJson.definitions); + }); res.json(swaggerBaseDocument); }); } @@ -2729,7 +2729,10 @@ export class RestApiBuilder extends BaseApiBuilder { 'swagger' ); const swaggerJson = JSON.parse( - await promisify(fs.readFile)(path.join(swaggerFilePath, 'swagger.json'), 'utf8') + await promisify(fs.readFile)( + path.join(swaggerFilePath, 'swagger.json'), + 'utf8' + ) ); /* remove tags, paths and keys */