Skip to content

Commit a5d160c

Browse files
committed
fix: tests
1 parent dd41287 commit a5d160c

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

packages/apidom-ns-asyncapi-2/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export {
1313
isStringElement,
1414
} from '@swagger-api/apidom-core';
1515

16-
export { default as mediaTypes } from './media-types';
16+
export { default as mediaTypes, AsyncAPIMediaTypes } from './media-types';
1717

1818
// eslint-disable-next-line no-restricted-exports
1919
export { default } from './namespace';

packages/apidom-ns-asyncapi-2/src/media-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MediaTypes } from '@swagger-api/apidom-core';
22

3-
class AsyncAPIMediaTypes extends MediaTypes<string> {
3+
export class AsyncAPIMediaTypes extends MediaTypes<string> {
44
forFormat(format = 'generic') {
55
const effectiveFormat = format === 'generic' ? 'asyncapi;version' : format;
66
return this.filter((mediaType) => mediaType.includes(effectiveFormat));

packages/apidom-parser-adapter-asyncapi-json-2/src/adapter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import { propOr, omit } from 'ramda';
22
import { isNotUndefined } from 'ramda-adjunct';
33
import { ParseResultElement, createNamespace } from '@swagger-api/apidom-core';
44
import { parse as parseJson } from '@swagger-api/apidom-parser-adapter-json';
5-
import asyncApiNamespace, { AsyncApi2Element, mediaTypes } from '@swagger-api/apidom-ns-asyncapi-2';
5+
import asyncApiNamespace, {
6+
AsyncApi2Element,
7+
mediaTypes,
8+
AsyncAPIMediaTypes,
9+
} from '@swagger-api/apidom-ns-asyncapi-2';
610

7-
const jsonMediaTypes = mediaTypes.forFormat('json');
11+
const jsonMediaTypes = new AsyncAPIMediaTypes(
12+
...mediaTypes.forFormat('generic'),
13+
...mediaTypes.forFormat('json'),
14+
);
815

916
export { jsonMediaTypes as mediaTypes };
1017

packages/apidom-parser-adapter-asyncapi-yaml-2/src/adapter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import { omit, propOr } from 'ramda';
22
import { isNotUndefined } from 'ramda-adjunct';
33
import { ParseResultElement, createNamespace } from '@swagger-api/apidom-core';
44
import { parse as parseYaml } from '@swagger-api/apidom-parser-adapter-yaml-1-2';
5-
import asyncApiNamespace, { AsyncApi2Element, mediaTypes } from '@swagger-api/apidom-ns-asyncapi-2';
5+
import asyncApiNamespace, {
6+
AsyncApi2Element,
7+
mediaTypes,
8+
AsyncAPIMediaTypes,
9+
} from '@swagger-api/apidom-ns-asyncapi-2';
610

7-
const yamlMediaTypes = mediaTypes.forFormat('yaml');
11+
const yamlMediaTypes = new AsyncAPIMediaTypes(
12+
...mediaTypes.forFormat('generic'),
13+
...mediaTypes.forFormat('yaml'),
14+
);
815

916
export { yamlMediaTypes as mediaTypes };
1017

0 commit comments

Comments
 (0)