fix(core): update

This commit is contained in:
Philipp Kunz 2021-11-19 20:16:01 +01:00
parent cf230c5b44
commit d11adfc704
2 changed files with 14 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import { expect, tap } from '@pushrocks/tapbundle';
import * as smartswagger from '../ts/index';
tap.test('first test', async () => {
console.log(smartswagger.standardExport);
console.log(smartswagger);
});
tap.start();

View File

@ -85,7 +85,7 @@ export class Smartswagger {
/**
* merges a document from url
*/
public async mergeDocumentFromUrl(documentUrlArg: string, basePathArg: string) {
public async mergeDocumentFromUrl(documentUrlArg: string, basePathArg: string = '') {
console.log(`getting document at ${documentUrlArg} for merging...`)
const documentResponse = await plugins.nodeFetch(documentUrlArg, {
headers: {
@ -98,6 +98,18 @@ export class Smartswagger {
await this.mergeDocument(apiDoc, basePathArg);
}
/**
* merge multiple documents in parallel
* @param urlArrayArg
*/
public async mergeManyDocumentsFromUrl(urlArrayArg: {url: string, basePath: string}[]) {
const promiseArray: Promise<void>[] = [];
for (const urlArg of urlArrayArg) {
promiseArray.push(this.mergeDocumentFromUrl(urlArg.url, urlArg.basePath));
};
await Promise.all(promiseArray);
}
/**
* merges a component to routes based on regex
*/