Skip to content

Commit 027ce3f

Browse files
Fix URL for AsyncAPI (#11)
* chore: add async api model * chore: add api-method-documentation dep * fix(url): render api-url component * test: fix tests * test: add test for async api * 4.2.1
1 parent a15872c commit 027ce3f

File tree

7 files changed

+888
-2260
lines changed

7 files changed

+888
-2260
lines changed

demo/apis.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"prevent-xss/prevent-xss.json": "OAS 2.0",
1010
"no-endpoints/no-endpoints.raml": "RAML 1.0",
1111
"google-drive-api/google-drive-api.raml": "RAML 1.0",
12+
"async-api/async-api.yaml": "ASYNC 2.0",
1213
"exchange-experience-api/exchange-experience-api.raml": "RAML 0.8",
1314
"multiple-servers/multiple-servers.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }
1415
}

demo/async-api/async-api.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
asyncapi: '2.0.0'
2+
info:
3+
title: Hello world application
4+
version: '0.1.0'
5+
servers:
6+
production:
7+
url: broker.mycompany.com
8+
protocol: amqp
9+
protocolVersion: 1.0.0
10+
description: This is "My Company" broker.
11+
security:
12+
- oAuth2: []
13+
- foo: []
14+
channels:
15+
hello:
16+
publish:
17+
message:
18+
$ref: '#/components/messages/hello-msg'
19+
goodbye:
20+
publish:
21+
message:
22+
$ref: '#/components/messages/goodbye-msg'
23+
components:
24+
messages:
25+
hello-msg:
26+
headers:
27+
$ref: '#/components/schemas/hello-headers'
28+
payload:
29+
type: object
30+
properties:
31+
name:
32+
type: string
33+
sentAt:
34+
$ref: '#/components/schemas/sent-at'
35+
goodbye-msg:
36+
headers:
37+
oneOf:
38+
- $ref: '#/components/schemas/goodbye-headers-1'
39+
- $ref: '#/components/schemas/goodbye-headers-2'
40+
payload:
41+
type: object
42+
properties:
43+
sentAt:
44+
$ref: '#/components/schemas/sent-at'
45+
schemas:
46+
sent-at:
47+
type: string
48+
description: The date and time a message was sent.
49+
format: datetime
50+
hello-headers:
51+
type: object
52+
properties:
53+
x-custom-header:
54+
description: You can put whatever you want here
55+
type: string
56+
Accept:
57+
description: You must specificy accept type for response
58+
type: string
59+
x-request-id:
60+
description: Request id for tracing errors
61+
type: string
62+
goodbye-headers-1:
63+
type: object
64+
properties:
65+
x-first-header:
66+
type: string
67+
x-second-header:
68+
type: string
69+
goodbye-headers-2:
70+
type: object
71+
properties:
72+
x-foo:
73+
type: string
74+
x-bar:
75+
type: string
76+
x-foo-bar:
77+
type: string
78+
securitySchemes:
79+
foo:
80+
type: userPassword
81+
description: This is the Foo scheme with username and password config
82+
oAuth2:
83+
type: oauth2
84+
flows:
85+
implicit:
86+
authorizationUrl: https://example.com/api/oauth/dialog
87+
scopes:
88+
write:pets: modify pets in your account
89+
read:pets: read your pets
90+
authorizationCode:
91+
authorizationUrl: https://example.com/api/oauth/dialog
92+
tokenUrl: https://example.com/api/oauth/token
93+
scopes:
94+
write:pets: modify pets in your account
95+
read:pets: read your pets

demo/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ApiDemo extends ApiDemoPage {
2424
['no-endpoints', 'No endpoints!'],
2525
['no-server', 'No server!'],
2626
['multiple-servers', 'Multiple servers'],
27+
['async-api', 'AsyncAPI'],
2728
].map(
2829
([file, label]) => html`
2930
<anypoint-item data-src="${file}-compact.json">${label}</anypoint-item>

0 commit comments

Comments
 (0)