Skip to content

Commit 3c20e10

Browse files
Add AsyncAPI support for URI (#9)
* chore(models): add async api * chore: computeWebApi -> computeApi * chore(deps): regenerate package-lock.json * feat(url): render api-url component * refactor: remove travis.yml * refactor: remove karma sl config * build: add github workflow * test: migrate test runner to web test runner * fix: stop handling computation of endpoint uri * test: add test for async api uri * 5.1.0
1 parent 2221623 commit 3c20e10

15 files changed

+7197
-3399
lines changed

.github/workflows/tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: tests
2+
3+
env:
4+
FORCE_COLOR: 1
5+
6+
on:
7+
push:
8+
pull_request:
9+
branches:
10+
- stage
11+
- master
12+
jobs:
13+
test_linux:
14+
name: ${{ matrix.os }} (${{ matrix.browser }})
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-18.04, ubuntu-20.04]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: actions/setup-node@v1
23+
with:
24+
node-version: 14
25+
- uses: microsoft/playwright-github-action@v1
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Run tests
29+
run: npm test
30+
# test_win:
31+
# name: "Windows"
32+
# strategy:
33+
# fail-fast: false
34+
# runs-on: windows-latest
35+
# steps:
36+
# - uses: actions/checkout@v2
37+
# - uses: actions/setup-node@v1
38+
# with:
39+
# node-version: 14
40+
# - uses: microsoft/playwright-github-action@v1
41+
# - name: Install dependencies
42+
# run: npm ci
43+
# - name: Run tests
44+
# run: npm test

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

demo/anypoint.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
return;
229229
}
230230
}
231-
const webApi = app.$.helper._computeWebApi(app.amfModel);
231+
const webApi = app.$.helper._computeApi(app.amfModel);
232232
const endpoint = app.$.helper._computeEndpointModel(webApi, eId);
233233
app.endpoint = endpoint;
234234
app.selectedShape = id;

demo/api.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"nexmo-sms-api/nexmo-sms-api.raml": "RAML 1.0",
55
"exchange-experience-api/exchange-experience-api.raml": "RAML 0.8",
66
"google-drive-api/google-drive-api.raml": "RAML 1.0",
7-
"multi-server/multi-server.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }
7+
"multi-server/multi-server.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
8+
"async-api/async-api.yaml": "ASYNC 2.0"
89
}

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import '@anypoint-web-components/anypoint-styles/typography.js';
1010
import '@advanced-rest-client/oauth-authorization/oauth2-authorization.js';
1111
import '@advanced-rest-client/oauth-authorization/oauth1-authorization.js';
1212
import '@advanced-rest-client/xhr-simple-request/xhr-simple-request.js';
13-
import '@api-components/api-server-selector/api-server-selector.js';
1413
import '../api-endpoint-documentation.js';
1514

1615
class ComponentDemo extends ApiDemoPage {
@@ -186,6 +185,7 @@ class ComponentDemo extends ApiDemoPage {
186185
['demo-api', 'Demo API'],
187186
['appian-api', 'Applian API'],
188187
['nexmo-sms-api', 'Nexmo SMS API'],
188+
['async-api', 'AsyncAPI'],
189189
].map(([file, label]) => html`
190190
<anypoint-item data-src="${file}-compact.json">${label} - compact model</anypoint-item>
191191
<anypoint-item data-src="${file}.json">${label}</anypoint-item>

demo/old.index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
return;
232232
}
233233
}
234-
const webApi = app.$.helper._computeWebApi(app.amfModel);
234+
const webApi = app.$.helper._computeApi(app.amfModel);
235235
const endpoint = app.$.helper._computeEndpointModel(webApi, eId);
236236
app.endpoint = endpoint;
237237
app.selectedShape = id;

karma.sl.config.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)