From 4bc1f534e221e999689d2a9606ba0078c79fe7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Wed, 3 Apr 2024 08:30:51 +0200 Subject: [PATCH] feat(converter): add support for asynchronous conversion plugins (#3997) Refs #3996 --- .../src/strategies/openapi-3-1-to-openapi-3-0-3/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/apidom-converter/src/strategies/openapi-3-1-to-openapi-3-0-3/index.ts b/packages/apidom-converter/src/strategies/openapi-3-1-to-openapi-3-0-3/index.ts index 8e78da0508..61e0de0877 100644 --- a/packages/apidom-converter/src/strategies/openapi-3-1-to-openapi-3-0-3/index.ts +++ b/packages/apidom-converter/src/strategies/openapi-3-1-to-openapi-3-0-3/index.ts @@ -10,9 +10,9 @@ import { } from '@swagger-api/apidom-ns-openapi-3-1'; import { ParseResultElement, - dispatchRefractorPlugins, AnnotationElement, cloneDeep, + dispatchRefractorPlugins as dispatchPlugins, } from '@swagger-api/apidom-core'; import ConvertStrategy, { IFile } from '../ConvertStrategy'; @@ -27,6 +27,8 @@ import licenseIdentifierRefractorPlugin from './refractor-plugins/license-identi import referenceDescriptionRefractorPlugin from './refractor-plugins/reference-description'; import referenceSummaryRefractorPlugin from './refractor-plugins/reference-summary'; +const dispatchPluginsAsync = dispatchPlugins[Symbol.for('nodejs.util.promisify.custom')]; + // eslint-disable-next-line @typescript-eslint/naming-convention const openAPI3_0_3MediaTypes = [ openAPI3_0MediaTypes.findBy('3.0.3', 'generic'), @@ -60,7 +62,7 @@ class OpenAPI31ToOpenAPI30ConvertStrategy extends ConvertStrategy { async convert(file: IFile): Promise { const annotations: AnnotationElement[] = []; - const parseResultElement: ParseResultElement = dispatchRefractorPlugins( + const parseResultElement: ParseResultElement = await dispatchPluginsAsync( cloneDeep(file.parseResult), [ openAPIVersionRefractorPlugin(),