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": [
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}`
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);
+ });
});
});
});