Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@api-components/api-endpoint-documentation",
"description": "A component to generate documentation for a resource from AMF model",
"version": "6.1.3",
"version": "6.1.4",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down
12 changes: 9 additions & 3 deletions src/ApiEndpointDocumentationElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,15 @@ export class ApiEndpointDocumentationElement extends AmfHelperMixin(LitElement)
// If it's gRPC, add stream type information
if (isGrpc && typeof this._getGrpcStreamType === 'function') {
operationData.grpcStreamType = this._getGrpcStreamType(op);
operationData.grpcStreamTypeDisplay = typeof this._getGrpcStreamTypeDisplayName === 'function'
? this._getGrpcStreamTypeDisplayName(operationData.grpcStreamType)
: operationData.grpcStreamType;

// Map stream type to simplified display labels (without "streaming")
const labelMap = {
'unary': 'UNARY',
'client_streaming': 'CLIENT',
'server_streaming': 'SERVER',
'bidi_streaming': 'BIDIRECTIONAL'
};
operationData.grpcStreamTypeDisplay = labelMap[operationData.grpcStreamType] || 'UNARY';

// Map stream type to HTTP method for consistent colors
const colorMethodMap = {
Expand Down
4 changes: 2 additions & 2 deletions test/api-endpoint-documentation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ describe('ApiEndpointDocumentationElement', () => {

const firstLabel = methodLabels[0];
const labelText = firstLabel.textContent.trim();
// The display name from AmfHelperMixin returns capitalized format (e.g., "Unary", "Client Streaming")
const validGrpcTypes = ['Unary', 'Client Streaming', 'Server Streaming', 'Bidirectional'];
// Simplified labels without "streaming" keyword
const validGrpcTypes = ['UNARY', 'CLIENT', 'SERVER', 'BIDIRECTIONAL'];
const isValidGrpcType = validGrpcTypes.some(type => labelText.includes(type));
assert.isTrue(isValidGrpcType, `should display a valid gRPC stream type, got: ${labelText}`);
});
Expand Down