File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed
apidom-parser-adapter-asyncapi-json-2/src
apidom-parser-adapter-asyncapi-yaml-2/src Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export {
13
13
isStringElement ,
14
14
} from '@swagger-api/apidom-core' ;
15
15
16
- export { default as mediaTypes } from './media-types' ;
16
+ export { default as mediaTypes , AsyncAPIMediaTypes } from './media-types' ;
17
17
18
18
// eslint-disable-next-line no-restricted-exports
19
19
export { default } from './namespace' ;
Original file line number Diff line number Diff line change 1
1
import { MediaTypes } from '@swagger-api/apidom-core' ;
2
2
3
- class AsyncAPIMediaTypes extends MediaTypes < string > {
3
+ export class AsyncAPIMediaTypes extends MediaTypes < string > {
4
4
forFormat ( format = 'generic' ) {
5
5
const effectiveFormat = format === 'generic' ? 'asyncapi;version' : format ;
6
6
return this . filter ( ( mediaType ) => mediaType . includes ( effectiveFormat ) ) ;
Original file line number Diff line number Diff line change @@ -2,9 +2,16 @@ import { propOr, omit } from 'ramda';
2
2
import { isNotUndefined } from 'ramda-adjunct' ;
3
3
import { ParseResultElement , createNamespace } from '@swagger-api/apidom-core' ;
4
4
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' ;
6
10
7
- const jsonMediaTypes = mediaTypes . forFormat ( 'json' ) ;
11
+ const jsonMediaTypes = new AsyncAPIMediaTypes (
12
+ ...mediaTypes . forFormat ( 'generic' ) ,
13
+ ...mediaTypes . forFormat ( 'json' ) ,
14
+ ) ;
8
15
9
16
export { jsonMediaTypes as mediaTypes } ;
10
17
Original file line number Diff line number Diff line change @@ -2,9 +2,16 @@ import { omit, propOr } from 'ramda';
2
2
import { isNotUndefined } from 'ramda-adjunct' ;
3
3
import { ParseResultElement , createNamespace } from '@swagger-api/apidom-core' ;
4
4
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' ;
6
10
7
- const yamlMediaTypes = mediaTypes . forFormat ( 'yaml' ) ;
11
+ const yamlMediaTypes = new AsyncAPIMediaTypes (
12
+ ...mediaTypes . forFormat ( 'generic' ) ,
13
+ ...mediaTypes . forFormat ( 'yaml' ) ,
14
+ ) ;
8
15
9
16
export { yamlMediaTypes as mediaTypes } ;
10
17
You can’t perform that action at this time.
0 commit comments