From ba363f2aa0b60ebf54660535d281859a47a34f88 Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Tue, 5 Jan 2021 15:33:57 -0300 Subject: [PATCH 1/3] fix: show channel and server when selected operation --- src/ApiUrl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ApiUrl.js b/src/ApiUrl.js index 536cbc2..131ccf5 100644 --- a/src/ApiUrl.js +++ b/src/ApiUrl.js @@ -191,15 +191,15 @@ export class ApiUrl extends AmfHelperMixin(LitElement) { } _getPathTemplate() { - if (this.isNotHttp) { + if (this.isNotHttp && !!this._method) { return html`
Channel${this.path}
`; } return undefined; } getUrlTemplate() { - const { url, isNotHttp } = this; - if (isNotHttp) { + const { url, isNotHttp, _method } = this; + if (isNotHttp && !!_method) { return html`
Server${url}
` } return html`${url}` From d1848c29430b76ab62cab09da66c40d5f6c51f19 Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Tue, 5 Jan 2021 15:34:53 -0300 Subject: [PATCH 2/3] test: show only url when no operation --- test/api-url.test.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/api-url.test.js b/test/api-url.test.js index a427768..070bba0 100644 --- a/test/api-url.test.js +++ b/test/api-url.test.js @@ -131,7 +131,7 @@ describe('', function () { beforeEach(async () => { const endpointName = 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured' - const [endpoint, operation] = AmfLoader.lookupEndpointOperation(amf, endpointName, 'subscribe'); + const [endpoint, operation] = AmfLoader.lookupEndpointOperation(amf, endpointName, 'kafka'); element = await basicFixture(); element.amf = amf; server = AmfLoader.getEncodes(amf)[element._getAmfKey(element.ns.aml.vocabularies.apiContract.server)]; @@ -152,6 +152,17 @@ describe('', function () { const server = 'Servermqtt://api.streetlights.smartylighting.com:{port}' assert.equal(element.shadowRoot.querySelector('.url-server-value').textContent, server); }); + + it('should only render url value when no operation selected', async () => { + element.amf = amf + element.operation = undefined + element.endpoint = undefined + await nextFrame(); + await nextFrame(); + + const url = 'mqtt://api.streetlights.smartylighting.com:{port}' + assert.equal(element.shadowRoot.querySelector('.url-value').textContent.trim(), url); + }); }); }); }); From 31cf89fd4ac04d4b0a8a2b76675ac57ee7f3e6f7 Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Tue, 5 Jan 2021 15:35:03 -0300 Subject: [PATCH 3/3] build: bump version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0db3de1..84a3476 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@api-components/api-method-documentation", - "version": "5.1.7", + "version": "5.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4f003f8..3ff5d42 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@api-components/api-method-documentation", "description": "A HTTP method documentation build from AMF model", - "version": "5.1.7", + "version": "5.1.8", "license": "Apache-2.0", "main": "api-method-documentation.js", "keywords": [