Skip to content

Commit e668505

Browse files
feat(W-15520218): add operation id
1 parent 1cbd040 commit e668505

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/ApiMethodDocumentation.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ export class ApiMethodDocumentation extends AmfHelperMixin(LitElement) {
804804
}
805805

806806
_getTitleTemplate() {
807+
const isAsyncApi = this._isAsyncAPI(this.amf)
807808
if (this._titleHidden) {
808809
return '';
809810
}
@@ -826,7 +827,7 @@ export class ApiMethodDocumentation extends AmfHelperMixin(LitElement) {
826827
</div>`}
827828
</div>
828829
${methodSummary ? html`<p class="summary">${methodSummary}</p>` : ''}
829-
${operationId ? html`<span class="operation-id">Operation ID: ${operationId}</span>` : ''}
830+
${operationId && !isAsyncApi ? html`<span class="operation-id">Operation ID: ${operationId}</span>` : ''}
830831
`;
831832
}
832833

@@ -846,6 +847,7 @@ export class ApiMethodDocumentation extends AmfHelperMixin(LitElement) {
846847
.apiVersion="${this.apiVersion}"
847848
.baseUri="${this.baseUri}"
848849
.operation="${this.method}"
850+
.operationId="${this.operationId}"
849851
@change="${this._handleUrlChange}"
850852
>
851853
</api-url>`;

src/ApiUrl.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ export class ApiUrl extends AmfHelperMixin(LitElement) {
5555
* @attribute
5656
*/
5757
baseUri: { type: String },
58+
/**
59+
* Optional, operation id that is render only for async api
60+
*/
61+
operationId:{type: String},
5862
_url: { type: String },
5963
_method: { type: String },
6064
_protocol: { type: String },
6165
_protocolVersion: { type: String },
6266
_operation: { type: Object },
63-
_server: { type: Object }
67+
_server: { type: Object },
68+
_operationId:{type: String}
6469
};
6570
}
6671

@@ -189,6 +194,14 @@ export class ApiUrl extends AmfHelperMixin(LitElement) {
189194
return null
190195
}
191196

197+
get operationId(){
198+
return this._operationId
199+
}
200+
201+
set operationId(value){
202+
this._operationId = value
203+
}
204+
192205
render() {
193206
const { url, asyncServersNames } = this;
194207
const isAsyncApi = this._isAsyncAPI(this.amf)
@@ -275,6 +288,7 @@ export class ApiUrl extends AmfHelperMixin(LitElement) {
275288
${this._getMethodTemplate()}
276289
<div class="async-servers">
277290
${this._getAsyncPathTemplate()}
291+
${this._getOperationIdTemplate()}
278292
${this._getAsyncServersNamesTemplate(asyncServersNames)}
279293
</div>
280294
</section>
@@ -289,6 +303,15 @@ export class ApiUrl extends AmfHelperMixin(LitElement) {
289303
return '';
290304
}
291305

306+
_getOperationIdTemplate() {
307+
const { operationId } = this;
308+
if (operationId) {
309+
return html`<div class="async-server-names-container">
310+
<span class="async-server-names-title">Operation ID: ${operationId}</span></div>`
311+
}
312+
return html``
313+
}
314+
292315
_getAsyncServersNamesTemplate(asyncServersNames) {
293316
const { _method } = this;
294317
if (asyncServersNames && !!_method) {

0 commit comments

Comments
 (0)