Skip to content
This repository was archived by the owner on Jun 18, 2023. It is now read-only.

Commit e6f4628

Browse files
committed
Improve mapping of message bindings to be more resilient if a backend creates a specification without message binding
1 parent 30c1e7b commit e6f4628

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/shared/asyncapi-mapper.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,14 @@ export class AsyncApiMapperService {
163163
}
164164

165165
private mapServerAsyncApiMessageBindings(
166-
serverMessageBindings: { [type: string]: ServerAsyncApiMessageBinding }
166+
serverMessageBindings?: { [type: string]: ServerAsyncApiMessageBinding }
167167
): Map<string, MessageBinding> {
168168
const messageBindings = new Map<string, MessageBinding>();
169-
Object.keys(serverMessageBindings).forEach((protocol) => {
170-
messageBindings.set(protocol, this.mapServerAsyncApiMessageBinding(serverMessageBindings[protocol]));
171-
});
169+
if (serverMessageBindings !== undefined) {
170+
Object.keys(serverMessageBindings).forEach((protocol) => {
171+
messageBindings.set(protocol, this.mapServerAsyncApiMessageBinding(serverMessageBindings[protocol]));
172+
});
173+
}
172174
return messageBindings;
173175
}
174176

0 commit comments

Comments
 (0)