fix(core): update
This commit is contained in:
@ -1 +1 @@
|
||||
export * from './smartswagger.classes.smartswagger';
|
||||
export * from './smartswagger.classes.smartswagger';
|
||||
|
@ -9,9 +9,9 @@ type IExtendedApiDoc = plugins.openapiTypes.OpenAPIV3.Document & RedocProps;
|
||||
export class Smartswagger {
|
||||
// STATIC
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param urlArg a url arg that contains an original swagger.json in the response
|
||||
* @returns an instance of
|
||||
* @returns an instance of
|
||||
*/
|
||||
public static async createFromUrl(urlArg: string) {
|
||||
const jsonResponse = await plugins.nodeFetch(urlArg, {
|
||||
@ -40,9 +40,7 @@ export class Smartswagger {
|
||||
* dereferences the document at hand
|
||||
*/
|
||||
public async deref() {
|
||||
this.apiDoc = (await plugins.swaggerParser.dereference(
|
||||
this.apiDoc
|
||||
)) as IExtendedApiDoc;
|
||||
this.apiDoc = (await plugins.swaggerParser.dereference(this.apiDoc)) as IExtendedApiDoc;
|
||||
}
|
||||
|
||||
public async addServer(serverArg: plugins.openapiTypes.OpenAPIV3.ServerObject) {
|
||||
@ -56,10 +54,7 @@ export class Smartswagger {
|
||||
* @param documentToMergeArg
|
||||
* @param basePathArg
|
||||
*/
|
||||
public async mergeDocument(
|
||||
documentToMergeArg: IExtendedApiDoc,
|
||||
basePathArg: string
|
||||
) {
|
||||
public async mergeDocument(documentToMergeArg: IExtendedApiDoc, basePathArg: string) {
|
||||
console.log(`merging document with name ${documentToMergeArg.info?.title}`);
|
||||
await this.deref();
|
||||
// lets get a dereferenced version of the document we want to merge
|
||||
@ -86,7 +81,7 @@ export class Smartswagger {
|
||||
* merges a document from url
|
||||
*/
|
||||
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, {
|
||||
headers: {
|
||||
'accept-encoding': 'application/json',
|
||||
@ -102,11 +97,11 @@ export class Smartswagger {
|
||||
* merge multiple documents in parallel
|
||||
* @param urlArrayArg
|
||||
*/
|
||||
public async mergeManyDocumentsFromUrl(urlArrayArg: {url: string, basePath: string}[]) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,17 @@
|
||||
// node native
|
||||
import * as path from 'path';
|
||||
|
||||
export {
|
||||
path
|
||||
}
|
||||
export { path };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as smartexpress from '@pushrocks/smartexpress';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export {
|
||||
smartexpress,
|
||||
smartpromise
|
||||
}
|
||||
export { smartexpress, smartpromise };
|
||||
|
||||
// third party
|
||||
import * as openapiTypes from 'openapi-types';
|
||||
import swaggerParser from '@apidevtools/swagger-parser';
|
||||
import nodeFetch from 'node-fetch';
|
||||
|
||||
export {
|
||||
openapiTypes,
|
||||
swaggerParser,
|
||||
nodeFetch
|
||||
}
|
||||
export { openapiTypes, swaggerParser, nodeFetch };
|
||||
|
Reference in New Issue
Block a user