File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed
apidom/packages/apidom-reference/test/dereference/strategies/asyncapi-2-0/message-object
fixtures/operation-object Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "asyncapi" : " 2.0.0" ,
4
+ "channels" : {
5
+ "user/signedup" : {
6
+ "subscribe" : {
7
+ "summary" : " A user signed up." ,
8
+ "operationId" : " emitUserSignUpEvent" ,
9
+ "message" : [
10
+ {
11
+ "name" : " userSignedUp" ,
12
+ "title" : " User signed up event" ,
13
+ "summary" : " Inform about a new user" ,
14
+ "contentType" : " application/json" ,
15
+ "payload" : {}
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ },
21
+ "components" : {
22
+ "messages" : {
23
+ "UserSignedUp" : {
24
+ "name" : " userSignedUp" ,
25
+ "title" : " User signed up event" ,
26
+ "summary" : " Inform about a new user" ,
27
+ "contentType" : " application/json" ,
28
+ "payload" : {}
29
+ }
30
+ }
31
+ }
32
+ }
33
+ ]
Original file line number Diff line number Diff line change
1
+ {
2
+ "asyncapi" : " 2.0.0" ,
3
+ "channels" : {
4
+ "user/signedup" : {
5
+ "subscribe" : {
6
+ "summary" : " A user signed up." ,
7
+ "operationId" : " emitUserSignUpEvent" ,
8
+ "message" : [
9
+ {
10
+ "$ref" : " #/components/messages/UserSignedUp"
11
+ }
12
+ ]
13
+ }
14
+ }
15
+ },
16
+ "components" : {
17
+ "messages" : {
18
+ "UserSignedUp" : {
19
+ "name" : " userSignedUp" ,
20
+ "title" : " User signed up event" ,
21
+ "summary" : " Inform about a new user" ,
22
+ "contentType" : " application/json" ,
23
+ "payload" : {}
24
+ }
25
+ }
26
+ }
27
+ }
Original file line number Diff line number Diff line change
1
+ import path from 'path' ;
2
+ import { assert } from 'chai' ;
3
+ import { toValue } from 'apidom' ;
4
+
5
+ import { loadJsonFile } from '../../../../helpers' ;
6
+ import { dereference } from '../../../../../src' ;
7
+
8
+ const rootFixturePath = path . join ( __dirname , 'fixtures' ) ;
9
+
10
+ describe ( 'dereference' , function ( ) {
11
+ context ( 'strategies' , function ( ) {
12
+ context ( 'asyncapi-2-0' , function ( ) {
13
+ context ( 'Message Object' , function ( ) {
14
+ context ( 'given in Operation Object' , function ( ) {
15
+ const fixturePath = path . join ( rootFixturePath , 'operation-object' ) ;
16
+
17
+ specify ( 'should dereference' , async function ( ) {
18
+ const rootFilePath = path . join ( fixturePath , 'root.json' ) ;
19
+ const actual = await dereference ( rootFilePath , {
20
+ parse : { mediaType : 'application/vnd.aai.asyncapi+json;version=2.0.0' } ,
21
+ } ) ;
22
+ const expected = loadJsonFile ( path . join ( fixturePath , 'dereferenced.json' ) ) ;
23
+
24
+ assert . deepEqual ( toValue ( actual ) , expected ) ;
25
+ } ) ;
26
+ } ) ;
27
+ } ) ;
28
+ } ) ;
29
+ } ) ;
30
+ } ) ;
You can’t perform that action at this time.
0 commit comments