Skip to content
This repository was archived by the owner on Jun 18, 2023. It is now read-only.

Commit 2b0b76a

Browse files
timonbackstavshamir
authored andcommitted
feat: Show also amqp and kafka data
Data is taken from the asyncapi.json file of the example projects
1 parent da3b643 commit 2b0b76a

File tree

5 files changed

+516
-87
lines changed

5 files changed

+516
-87
lines changed

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { SchemaComponent } from './schemas/schema/schema.component';
1616
import { SchemasComponent } from './schemas/schemas.component';
1717
import { ServersComponent } from './servers/servers.component';
1818
import { AsyncApiService } from './shared/asyncapi.service';
19-
import { MockServer } from './shared/mock-server';
19+
import { MockServer } from './shared/mock/mock-server';
2020
import { PublisherService } from './shared/publisher.service';
2121
import { FormsModule } from '@angular/forms';
2222
import { JsonComponent } from './shared/components/json/json.component';

src/app/shared/mock-server.ts renamed to src/app/shared/mock/mock-server.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { InMemoryDbService, RequestInfo, STATUS } from 'angular-in-memory-web-api';
2-
import mockAsyncApi from './mock.json';
2+
import mockSpringwolfApp from './mock.springwolf-app.json';
3+
import mockSpringwolfAmqp from './mock.springwolf-amqp-example.json';
4+
import mockSpringwolfKafka from './mock.springwolf-kafka-example.json';
5+
6+
const mockAsyncApi = {
7+
...mockSpringwolfApp,
8+
...mockSpringwolfAmqp,
9+
...mockSpringwolfKafka,
10+
}
311

412
export class MockServer implements InMemoryDbService {
513
createDb() {
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
{
2+
"Springwolf example project - AMQP": {
3+
"asyncapi": "2.0.0",
4+
"info": {
5+
"title": "Springwolf example project - AMQP",
6+
"version": "1.0.0"
7+
},
8+
"servers": {
9+
"amqp": {
10+
"url": "amqp:5672",
11+
"protocol": "amqp"
12+
}
13+
},
14+
"channels": {
15+
"example-bindings-queue": {
16+
"bindings": {
17+
"amqp": {
18+
"is": "routingKey",
19+
"exchange": {
20+
"name": "name",
21+
"autoDelete": false
22+
}
23+
}
24+
},
25+
"publish": {
26+
"bindings": {
27+
"amqp": {
28+
"cc": [
29+
""
30+
],
31+
"expiration": 0,
32+
"priority": 0,
33+
"deliveryMode": 0,
34+
"mandatory": false,
35+
"timestamp": false,
36+
"ack": false
37+
}
38+
},
39+
"message": {
40+
"name": "io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto",
41+
"title": "AnotherPayloadDto",
42+
"payload": {
43+
"$ref": "#/components/schemas/AnotherPayloadDto"
44+
}
45+
}
46+
}
47+
},
48+
"example-topic-queue": {
49+
"bindings": {
50+
"amqp": {
51+
"is": "routingKey",
52+
"exchange": {
53+
"name": "example-topic-exchange",
54+
"autoDelete": false
55+
}
56+
}
57+
},
58+
"publish": {
59+
"bindings": {
60+
"amqp": {
61+
"cc": [
62+
"example-topic-routing-key"
63+
],
64+
"expiration": 0,
65+
"priority": 0,
66+
"deliveryMode": 0,
67+
"mandatory": false,
68+
"timestamp": false,
69+
"ack": false
70+
}
71+
},
72+
"message": {
73+
"name": "io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto",
74+
"title": "AnotherPayloadDto",
75+
"payload": {
76+
"$ref": "#/components/schemas/AnotherPayloadDto"
77+
}
78+
}
79+
}
80+
},
81+
"another-queue": {
82+
"bindings": {
83+
"amqp": {
84+
"is": "routingKey",
85+
"exchange": {
86+
"name": "",
87+
"autoDelete": false
88+
}
89+
}
90+
},
91+
"publish": {
92+
"bindings": {
93+
"amqp": {
94+
"cc": [
95+
"another-queue"
96+
],
97+
"expiration": 0,
98+
"priority": 0,
99+
"deliveryMode": 0,
100+
"mandatory": false,
101+
"timestamp": false,
102+
"ack": false
103+
}
104+
},
105+
"message": {
106+
"name": "io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto",
107+
"title": "AnotherPayloadDto",
108+
"payload": {
109+
"$ref": "#/components/schemas/AnotherPayloadDto"
110+
}
111+
}
112+
}
113+
},
114+
"example-manual-consumer-channel": {
115+
"publish": {
116+
"bindings": {
117+
"amqp": {
118+
"expiration": 0,
119+
"cc": [
120+
"example-consumer-topic-routing-key"
121+
],
122+
"priority": 0,
123+
"deliveryMode": 0,
124+
"mandatory": false,
125+
"timestamp": false,
126+
"ack": false
127+
}
128+
},
129+
"message": {
130+
"name": "io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto",
131+
"title": "AnotherPayloadDto",
132+
"description": "example-manual-consumer-channel-description",
133+
"payload": {
134+
"$ref": "#/components/schemas/AnotherPayloadDto"
135+
}
136+
}
137+
},
138+
"bindings": {
139+
"amqp": {
140+
"is": "routingKey",
141+
"exchange": {
142+
"name": "example-consumer-topic-exchange",
143+
"autoDelete": false
144+
}
145+
}
146+
}
147+
},
148+
"example-queue": {
149+
"bindings": {
150+
"amqp": {
151+
"is": "routingKey",
152+
"exchange": {
153+
"name": "",
154+
"autoDelete": false
155+
}
156+
}
157+
},
158+
"publish": {
159+
"bindings": {
160+
"amqp": {
161+
"cc": [
162+
"example-queue"
163+
],
164+
"expiration": 0,
165+
"priority": 0,
166+
"deliveryMode": 0,
167+
"mandatory": false,
168+
"timestamp": false,
169+
"ack": false
170+
}
171+
},
172+
"message": {
173+
"name": "io.github.stavshamir.springwolf.example.dtos.ExamplePayloadDto",
174+
"title": "ExamplePayloadDto",
175+
"payload": {
176+
"$ref": "#/components/schemas/ExamplePayloadDto"
177+
}
178+
}
179+
}
180+
},
181+
"example-producer-channel": {
182+
"bindings": {
183+
"amqp": {
184+
"is": "routingKey",
185+
"exchange": {
186+
"name": "example-topic-exchange",
187+
"autoDelete": false
188+
}
189+
}
190+
},
191+
"subscribe": {
192+
"bindings": {
193+
"amqp": {
194+
"cc": [
195+
"example-topic-routing-key"
196+
],
197+
"expiration": 0,
198+
"priority": 0,
199+
"deliveryMode": 0,
200+
"mandatory": false,
201+
"timestamp": false,
202+
"ack": false
203+
}
204+
},
205+
"message": {
206+
"name": "io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto",
207+
"title": "AnotherPayloadDto",
208+
"description": "example-producer-channel-description",
209+
"payload": {
210+
"$ref": "#/components/schemas/AnotherPayloadDto"
211+
}
212+
}
213+
}
214+
}
215+
},
216+
"components": {
217+
"schemas": {
218+
"AnotherPayloadDto": {
219+
"required": [
220+
"example"
221+
],
222+
"type": "object",
223+
"properties": {
224+
"foo": {
225+
"type": "string",
226+
"description": "Foo field",
227+
"example": "bar",
228+
"exampleSetFlag": true
229+
},
230+
"example": {
231+
"$ref": "#/components/schemas/ExamplePayloadDto",
232+
"exampleSetFlag": false
233+
}
234+
},
235+
"description": "Another payload model",
236+
"example": {
237+
"foo": "bar",
238+
"example": {
239+
"someString": "some string value",
240+
"someLong": 5,
241+
"someEnum": "FOO2"
242+
}
243+
},
244+
"exampleSetFlag": true
245+
},
246+
"ExamplePayloadDto": {
247+
"required": [
248+
"someEnum",
249+
"someString"
250+
],
251+
"type": "object",
252+
"properties": {
253+
"someString": {
254+
"type": "string",
255+
"description": "Some string field",
256+
"example": "some string value",
257+
"exampleSetFlag": true
258+
},
259+
"someLong": {
260+
"type": "integer",
261+
"description": "Some long field",
262+
"format": "int64",
263+
"example": 5,
264+
"exampleSetFlag": true
265+
},
266+
"someEnum": {
267+
"type": "string",
268+
"description": "Some enum field",
269+
"example": "FOO2",
270+
"exampleSetFlag": true,
271+
"enum": [
272+
"FOO1",
273+
"FOO2",
274+
"FOO3"
275+
]
276+
}
277+
},
278+
"description": "Example payload model",
279+
"example": {
280+
"someString": "some string value",
281+
"someLong": 5,
282+
"someEnum": "FOO2"
283+
},
284+
"exampleSetFlag": true
285+
}
286+
}
287+
}
288+
}
289+
}

0 commit comments

Comments
 (0)