From 682de39524e7abf8a5ce947eb39120b276be175c Mon Sep 17 00:00:00 2001 From: Viacheslav Turovskyi Date: Mon, 11 Mar 2024 08:32:45 +0000 Subject: [PATCH] feat: add `x-origin` property --- src/index.ts | 2 +- src/util.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index f357e84..8b67b21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,7 +98,7 @@ export default async function bundle(files: string[], options: any = {}) { resolvedJsons = await resolve(parsedJsons, options); } - return new Document(resolvedJsons as AsyncAPIObject[], options.base); + return new Document(resolvedJsons, options.base); } // 'module.exports' is added to maintain backward compatibility with Node.js diff --git a/src/util.ts b/src/util.ts index 637932c..6c2fa6f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,7 +1,6 @@ import fs from 'fs'; -import $RefParser from '@apidevtools/json-schema-ref-parser'; import axios from 'axios'; -import { cloneDeep, merge } from 'lodash'; +import { merge } from 'lodash'; import yaml from 'js-yaml'; import { parse } from './parser'; import { ParserError } from './errors'; @@ -145,8 +144,6 @@ export function resolveBaseFileDir(file: object, baseFileDir: string) { ); } -// Moved 'addXOrigins' to the beginning of the scope to avoid an ESLint's error -// `'addXOrigins' was used before it was defined` export function addXOrigins(asyncapiDocument: AsyncAPIObject) { // VALUE from 'asyncapiDocument' becomes KEY for the // underlying and recursive functions