Skip to content

Commit

Permalink
feat(apidom-playground): add Workflows Spec support (#3535)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankkilcommins authored Dec 14, 2023
1 parent 7175a1d commit cd1b8f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/apidom-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand All @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion packages/apidom-playground/src/playground/apidom.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand Down
7 changes: 7 additions & 0 deletions packages/apidom-playground/src/playground/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -125,6 +131,7 @@ export const selectMediaTypes = (() => {
...openApi3_0MediaTypes,
...openApi3_1MediaTypes,
...asyncApi2MediaTypes,
...workflowsSpecification1MediaTypes,
];
return () => allMediaTypes;
})();
Expand Down

0 comments on commit cd1b8f6

Please sign in to comment.