From cd1b8f61d09c9c4b7e151a3dee764ca5464e2c5c Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Thu, 14 Dec 2023 13:45:11 +0000 Subject: [PATCH] feat(apidom-playground): add Workflows Spec support (#3535) --- packages/apidom-playground/package.json | 3 +++ packages/apidom-playground/src/playground/apidom.worker.js | 6 +++++- packages/apidom-playground/src/playground/selectors.js | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/apidom-playground/package.json b/packages/apidom-playground/package.json index afa440b18a..14470fc65a 100644 --- a/packages/apidom-playground/package.json +++ b/packages/apidom-playground/package.json @@ -32,6 +32,7 @@ "@swagger-api/apidom-ns-openapi-2": "*", "@swagger-api/apidom-ns-openapi-3-0": "*", "@swagger-api/apidom-ns-openapi-3-1": "*", + "@swagger-api/apidom-ns-workflows-1": "*", "@swagger-api/apidom-parser": "*", "@swagger-api/apidom-parser-adapter-asyncapi-json-2": "*", "@swagger-api/apidom-parser-adapter-asyncapi-yaml-2": "*", @@ -42,6 +43,8 @@ "@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": "*", "@swagger-api/apidom-parser-adapter-openapi-json-3-1": "*", "@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "*", + "@swagger-api/apidom-parser-adapter-workflows-json-1": "*", + "@swagger-api/apidom-parser-adapter-workflows-yaml-1": "*", "@swagger-api/apidom-parser-adapter-yaml-1-2": "*", "@swagger-api/apidom-reference": "*", "classnames": "^2.3.2", diff --git a/packages/apidom-playground/src/playground/apidom.worker.js b/packages/apidom-playground/src/playground/apidom.worker.js index 17ead377e6..7bfc8d37ae 100644 --- a/packages/apidom-playground/src/playground/apidom.worker.js +++ b/packages/apidom-playground/src/playground/apidom.worker.js @@ -12,6 +12,8 @@ import * as openapi3_1AdapterJson from '@swagger-api/apidom-parser-adapter-opena import * as openapi3_1AdapterYaml from '@swagger-api/apidom-parser-adapter-openapi-yaml-3-1'; import * as asyncapi2AdapterJson from '@swagger-api/apidom-parser-adapter-asyncapi-json-2'; import * as asyncapi2AdapterYaml from '@swagger-api/apidom-parser-adapter-asyncapi-yaml-2'; +import * as workflows1AdapterJson from '@swagger-api/apidom-parser-adapter-workflows-json-1'; +import * as workflows1AdapterYaml from '@swagger-api/apidom-parser-adapter-workflows-yaml-1'; import { readFile, resolveApiDOM as resolveApiDOMReferences, @@ -28,7 +30,9 @@ const parser = ApiDOMParser() .use(openapi3_1AdapterJson) .use(openapi3_1AdapterYaml) .use(asyncapi2AdapterJson) - .use(asyncapi2AdapterYaml); + .use(asyncapi2AdapterYaml) + .use(workflows1AdapterJson) + .use(workflows1AdapterYaml); /* eslint-disable */ const service = { diff --git a/packages/apidom-playground/src/playground/selectors.js b/packages/apidom-playground/src/playground/selectors.js index 541d4c481e..480bb683c9 100644 --- a/packages/apidom-playground/src/playground/selectors.js +++ b/packages/apidom-playground/src/playground/selectors.js @@ -14,6 +14,9 @@ import openApi3_1NsPlugin, { import asyncApi2NsPlugin, { mediaTypes as asyncApi2MediaTypes, } from '@swagger-api/apidom-ns-asyncapi-2'; +import workflowsSpecification1NsPlugin, { + mediaTypes as workflowsSpecification1MediaTypes, +} from '@swagger-api/apidom-ns-workflows-1'; import { mediaTypes as jsonMediaTypes } from '@swagger-api/apidom-parser-adapter-json'; import { mediaTypes as yamlMediaTypes } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; @@ -51,6 +54,9 @@ export const selectApiDOMNamespace = createSelector(selectMediaType, (mediaType) if (asyncApi2MediaTypes.includes(mediaType)) { return createNamespace(asyncApi2NsPlugin); } + if (workflowsSpecification1MediaTypes.includes(mediaType)) { + return createNamespace(workflowsSpecification1NsPlugin); + } return createNamespace(); }); @@ -125,6 +131,7 @@ export const selectMediaTypes = (() => { ...openApi3_0MediaTypes, ...openApi3_1MediaTypes, ...asyncApi2MediaTypes, + ...workflowsSpecification1MediaTypes, ]; return () => allMediaTypes; })();