From 3f8201a791569454b561b9da8b6df4fc2db6ce7e 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 | 6 ++---- 2 files changed, 3 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..b7d05d3 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,7 @@ 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` +// eslint-disable-next-line export function addXOrigins(asyncapiDocument: AsyncAPIObject) { // VALUE from 'asyncapiDocument' becomes KEY for the // underlying and recursive functions