Skip to content

Commit 605639f

Browse files
v6.3.3 (#662)
* chore(models): add APIC-553.raml * feat(deps): regenerate package-lock.json * test: add test cases for major fixes * 6.3.3 * test: fix test after model change
1 parent 9a18317 commit 605639f

File tree

7 files changed

+145
-15
lines changed

7 files changed

+145
-15
lines changed

demo/apis.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
"models/apic-83/apic-83.raml": "RAML 1.0",
1414
"models/multi-server/multi-server.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
1515
"models/oas-3-api/oas-3-api.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
16-
"models/async-api/async-api.yaml": "ASYNC 2.0"
16+
"models/async-api/async-api.yaml": "ASYNC 2.0",
17+
"models/APIC-553/APIC-553.raml": "RAML 1.0",
18+
"models/APIC-554/APIC-554.raml": "RAML 1.0"
1719
}

demo/element/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ApicApplication extends DemoBase {
2222
['multi-server', 'Multi Server API'],
2323
['oas-3-api', 'OAS 3 API'],
2424
['async-api', 'AsyncAPI'],
25+
['APIC-553', 'APIC-553'],
2526
];
2627

2728
this.toggleConsoleMenu = this.toggleConsoleMenu.bind(this);

demo/models/APIC-553/APIC-553.raml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#%RAML 1.0
2+
baseUri: http://domain.org
3+
4+
title: Array does not work API
5+
version: 1.0
6+
mediaType: application/json
7+
8+
types:
9+
ORX_ARRAY:
10+
type: array
11+
items: string
12+
minItems: 1
13+
ORX_STR_WITH_EXAMPLE:
14+
type: string
15+
example: foo
16+
17+
18+
19+
/cmt:
20+
get:
21+
queryParameters:
22+
orx:
23+
description: List ORX type.
24+
type: ORX_ARRAY
25+
required: true
26+
details:
27+
displayName: details
28+
type: string
29+
required: false
30+
modemCount:
31+
displayName: modemCount
32+
type: string
33+
required: false
34+
responses:
35+
200:
36+
body:
37+
application/json:
38+
/cmt-with-qp-example:
39+
get:
40+
queryParameters:
41+
orx:
42+
description: ORX type.
43+
type: string
44+
required: true
45+
example: foo
46+
details:
47+
displayName: details
48+
type: string
49+
required: false
50+
modemCount:
51+
displayName: modemCount
52+
type: string
53+
required: false
54+
responses:
55+
200:
56+
body:
57+
application/json:

demo/models/APIC-554/APIC-554.raml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#%RAML 1.0
2+
title: api
3+
4+
/customer/{customerId}/chromeos:
5+
/customer/{customerId}/chromeos/deviceId:
6+
/customer/{customerId}/chromeos/deviceId/customerId:

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "api-console",
33
"description": "The API Console to automatically generate API documentation from RAML and OAS files.",
4-
"version": "6.3.2",
4+
"version": "6.3.3",
55
"license": "CPAL-1.0",
66
"main": "index.js",
77
"module": "index.js",

test/api-console.amf.test.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ describe('<api-console>', function() {
2727
return element;
2828
}
2929

30+
function selectOperation(element, endpointName, operationName) {
31+
const operation = AmfLoader.lookupOperation(element.amf, endpointName, operationName);
32+
const operationId = operation['@id'];
33+
element.selectedShape = operationId;
34+
element.selectedShapeType = 'method';
35+
}
36+
3037
describe('AMF model computations', () => {
3138
[
3239
new ApiDescribe('Regular model'),
@@ -206,4 +213,61 @@ describe('<api-console>', function() {
206213
});
207214
});
208215
});
216+
217+
describe('APIC-553', () => {
218+
[
219+
new ApiDescribe('Regular model'),
220+
new ApiDescribe('Compact model', true),
221+
].forEach(({ label, compact }) => {
222+
describe(label, () => {
223+
let amf;
224+
let element;
225+
226+
before(async () => {
227+
amf = await AmfLoader.load({ compact, fileName: 'APIC-553' });
228+
});
229+
230+
beforeEach(async () => {
231+
element = await amfFixture(amf);
232+
await aTimeout(0);
233+
});
234+
235+
it('should have URL set', async () => {
236+
selectOperation(element, '/cmt', 'get');
237+
await nextFrame();
238+
await nextFrame();
239+
const apiDocumentation = element.shadowRoot.querySelector('api-documentation');
240+
const apiMethodDocumentation = apiDocumentation.shadowRoot.querySelector('api-method-documentation');
241+
assert.equal(apiMethodDocumentation.shadowRoot.querySelector('api-url').url, 'http://domain.org/cmt');
242+
});
243+
});
244+
});
245+
});
246+
247+
describe('APIC-554', () => {
248+
[
249+
new ApiDescribe('Regular model'),
250+
new ApiDescribe('Compact model', true),
251+
].forEach(({ label, compact }) => {
252+
describe(label, () => {
253+
let amf;
254+
let element;
255+
256+
before(async () => {
257+
amf = await AmfLoader.load({ compact, fileName: 'APIC-554' });
258+
});
259+
260+
beforeEach(async () => {
261+
element = await amfFixture(amf);
262+
await aTimeout(0);
263+
});
264+
265+
it('should set correct navigation labels', async () => {
266+
const apiNavigation = element.shadowRoot.querySelector('api-navigation');
267+
const labels = ['/customer/{customerId}/chromeos', '/deviceId', '/customerId'];
268+
assert.deepEqual(apiNavigation._endpoints.map(e => e.label), labels);
269+
});
270+
});
271+
});
272+
});
209273
});

0 commit comments

Comments
 (0)