Browse Source

fix: wrap await call

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5018/head
Pranav C 2 years ago
parent
commit
f9f28f245e
  1. 25
      packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts

25
packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts

@ -2649,7 +2649,8 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
scheme, scheme,
scheme === 'http' ? 'https' : 'http', scheme === 'http' ? 'https' : 'http',
]; ];
await promisify(glob)( (
await promisify(glob)(
path.join( path.join(
this.app.getToolDir(), this.app.getToolDir(),
'nc', 'nc',
@ -2659,15 +2660,14 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
'swagger.json' 'swagger.json'
) )
) )
.forEach(async (jsonFile) => { ).forEach(async (jsonFile) => {
const swaggerJson = JSON.parse(await promisify(fs.readFile)(jsonFile, 'utf8')); const swaggerJson = JSON.parse(
swaggerBaseDocument.tags.push(...swaggerJson.tags); await promisify(fs.readFile)(jsonFile, 'utf8')
Object.assign(swaggerBaseDocument.paths, swaggerJson.paths); );
Object.assign( swaggerBaseDocument.tags.push(...swaggerJson.tags);
swaggerBaseDocument.definitions, Object.assign(swaggerBaseDocument.paths, swaggerJson.paths);
swaggerJson.definitions Object.assign(swaggerBaseDocument.definitions, swaggerJson.definitions);
); });
});
res.json(swaggerBaseDocument); res.json(swaggerBaseDocument);
}); });
} }
@ -2729,7 +2729,10 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
'swagger' 'swagger'
); );
const swaggerJson = JSON.parse( 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 */ /* remove tags, paths and keys */

Loading…
Cancel
Save