2 Commits

Author SHA1 Message Date
cdb3c27637 1.0.5 2021-11-19 20:16:01 +01:00
d11adfc704 fix(core): update 2021-11-19 20:16:01 +01:00
4 changed files with 17 additions and 5 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartswagger", "name": "@pushrocks/smartswagger",
"version": "1.0.4", "version": "1.0.5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartswagger", "name": "@pushrocks/smartswagger",
"version": "1.0.4", "version": "1.0.5",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "^10.0.3", "@apidevtools/swagger-parser": "^10.0.3",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartswagger", "name": "@pushrocks/smartswagger",
"version": "1.0.4", "version": "1.0.5",
"private": false, "private": false,
"description": "a swagger tookit for working with swagger files", "description": "a swagger tookit for working with swagger files",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

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

View File

@@ -85,7 +85,7 @@ export class Smartswagger {
/** /**
* merges a document from url * 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...`) console.log(`getting document at ${documentUrlArg} for merging...`)
const documentResponse = await plugins.nodeFetch(documentUrlArg, { const documentResponse = await plugins.nodeFetch(documentUrlArg, {
headers: { headers: {
@@ -98,6 +98,18 @@ export class Smartswagger {
await this.mergeDocument(apiDoc, basePathArg); 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 * merges a component to routes based on regex
*/ */