Skip to content

Commit

Permalink
feat(converter): add support for asynchronous conversion plugins (#3997)
Browse files Browse the repository at this point in the history
Refs #3996
  • Loading branch information
char0n committed Apr 3, 2024
1 parent 5faa639 commit 4bc1f53
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -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';
Expand All @@ -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'),
Expand Down Expand Up @@ -60,7 +62,7 @@ class OpenAPI31ToOpenAPI30ConvertStrategy extends ConvertStrategy {

async convert(file: IFile): Promise<ParseResultElement> {
const annotations: AnnotationElement[] = [];
const parseResultElement: ParseResultElement = dispatchRefractorPlugins(
const parseResultElement: ParseResultElement = await dispatchPluginsAsync(
cloneDeep(file.parseResult),
[
openAPIVersionRefractorPlugin(),
Expand Down

0 comments on commit 4bc1f53

Please sign in to comment.