From 29fc90560d4a9b62cb2257e4dc22db8b291c3405 Mon Sep 17 00:00:00 2001 From: alexp mule Date: Tue, 19 May 2026 00:57:06 -0300 Subject: [PATCH 1/3] @W-21813981 fix: remove incorrect gRPC override that misidentified AsyncAPI operations The local _isGrpcOperation override in ApiUrl.js treated publish/subscribe method names as gRPC indicators, causing AsyncAPI operations to display "CLIENT"/"SERVER" labels instead of "PUBLISH"/"SUBSCRIBE". The inherited AmfHelperMixin implementation correctly identifies gRPC by payload media type. Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/ApiUrl.js | 66 --------------------------------------------------- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/package.json b/package.json index 4e03723..0a0dca6 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.2.30", + "version": "5.2.31", "license": "Apache-2.0", "main": "index.js", "module": "index.js", diff --git a/src/ApiUrl.js b/src/ApiUrl.js index fc4c096..ddcc5cc 100644 --- a/src/ApiUrl.js +++ b/src/ApiUrl.js @@ -365,72 +365,6 @@ export class ApiUrl extends AmfHelperMixin(LitElement) { // ========== gRPC Support Methods ========== - /** - * Checks if the given operation is a gRPC operation - * @param {Object} operation Operation model - * @return {boolean} - */ - _isGrpcOperation(operation) { - if (!operation) { - return false; - } - - // Check for gRPC-specific methods - const method = this._getValue(operation, this.ns.aml.vocabularies.apiContract.method); - if (method && typeof method === 'string' && ['publish', 'subscribe', 'pubsub'].includes(method.toLowerCase())) { - return true; - } - - // Check for gRPC media type in request - const expects = this._computeExpects(operation); - if (expects) { - const payloadKey = this._getAmfKey(this.ns.aml.vocabularies.apiContract.payload); - const payloads = this._ensureArray(expects[payloadKey]); - - if (payloads && payloads.length > 0) { - const mediaType = this._getValue(payloads[0], this.ns.aml.vocabularies.core.mediaType); - if (mediaType && typeof mediaType === 'string' && - (mediaType === 'application/grpc' || mediaType === 'application/grpc+proto')) { - return true; - } - } - } - - return false; - } - - /** - * Gets the gRPC stream type for an operation - * @param {Object} operation Operation model - * @return {string} Stream type: 'unary', 'client_streaming', 'server_streaming', or 'bidi_streaming' - */ - _getGrpcStreamType(operation) { - if (!operation) { - return 'unary'; - } - - const method = this._getValue(operation, this.ns.aml.vocabularies.apiContract.method); - - if (!method || typeof method !== 'string') { - return 'unary'; - } - - // Map methods to gRPC stream types - const methodLower = method.toLowerCase(); - switch (methodLower) { - case 'publish': - return 'client_streaming'; - case 'subscribe': - return 'server_streaming'; - case 'pubsub': - return 'bidi_streaming'; - case 'post': - case 'get': - default: - return 'unary'; - } - } - /** * Gets the display name for a gRPC stream type * @param {string} streamType Stream type From 5957328c43e2f0a8b1b7e3d9edcb50f9d5919923 Mon Sep 17 00:00:00 2001 From: alexp mule Date: Tue, 19 May 2026 01:08:07 -0300 Subject: [PATCH 2/3] @W-21813981 test: add assertions for rendered AsyncAPI operation labels Verify that the method-label element displays PUBLISH/SUBSCRIBE (not CLIENT/SERVER) for AsyncAPI operations in both compact and full models. Co-Authored-By: Claude Opus 4.6 --- test/api-url.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/api-url.test.js b/test/api-url.test.js index 96178e3..ccb9fa3 100644 --- a/test/api-url.test.js +++ b/test/api-url.test.js @@ -122,6 +122,12 @@ describe('', () => { it('should compute method', () => { assert.equal(element._method, 'PUBLISH'); }); + + it('should render PUBLISH as the displayed method label', async () => { + await waitUntil(() => element.shadowRoot.querySelector('.method-label')); + const label = element.shadowRoot.querySelector('.method-label'); + assert.equal(label.textContent.trim(), 'PUBLISH'); + }); }); describe('APIC-560', () => { @@ -159,6 +165,12 @@ describe('', () => { assert.equal(element.shadowRoot.querySelector('.async-server-name').textContent, expectedServer); }); + it('should render SUBSCRIBE as the displayed method label', async () => { + await waitUntil(() => element.shadowRoot.querySelector('.method-label')); + const label = element.shadowRoot.querySelector('.method-label'); + assert.equal(label.textContent.trim(), 'SUBSCRIBE'); + }); + it('should only render url value when no operation selected', async () => { element.amf = amf element.operation = undefined From d0697ea8e9404381b4008b7ec6f83bbe723e2392 Mon Sep 17 00:00:00 2001 From: alexp mule Date: Wed, 20 May 2026 12:44:40 -0300 Subject: [PATCH 3/3] chore: update package-lock.json for 5.2.31 Co-Authored-By: Claude Opus 4.6 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9dabce1..601e37c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@api-components/api-method-documentation", - "version": "5.2.30", + "version": "5.2.31", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@api-components/api-method-documentation", - "version": "5.2.30", + "version": "5.2.31", "license": "Apache-2.0", "dependencies": { "@advanced-rest-client/arc-icons": "^3.3.4",