Skip to content

Commit

Permalink
remove messageId
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Nov 17, 2023
1 parent 213f12c commit 532be4a
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 554 deletions.
5 changes: 2 additions & 3 deletions components/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export function Message({ message }) { // NOSONAR
return null;
}

// check typeof as fallback for older version than `2.4.0`
const messageId = typeof message.messageId === 'function' && message.messageId();
const messageId = message.id();
const headers = message.headers();
const payload = message.payload();
const correlationId = message.correlationId();
Expand All @@ -26,7 +25,7 @@ export function Message({ message }) { // NOSONAR
if (message.title()) {
header += ` ${message.title()}`;
}
const id = message.messageId() || message.name() || message.id();
const id = message.name() || messageId;
if (id) {
header += ` \`${id}\``;
}
Expand Down
16 changes: 8 additions & 8 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
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@asyncapi/cli": "^0.60.1",
"@asyncapi/parser": "^3.0.0-next-major-spec.3",
"@asyncapi/parser": "^3.0.0-next-major-spec.11",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@types/react": "^18.2.18",
Expand Down
4 changes: 2 additions & 2 deletions test/components/Message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ describe('Message component', () => {
}
}
]
});
}, { id: 'UserSignup Message Id' });
const expected = `
#### Message User signup \`UserSignup Message Id\`
#### Message User signup \`UserSignup\`
*Action to sign a user up.*
Expand Down
1 change: 0 additions & 1 deletion test/components/Operations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,6 @@ A longer description of the message
}
},
SomeMessage2: {
messageId: 'SomeMessage2',
description: 'A longer description of the message',
payload: {
type: 'object',
Expand Down
Loading

0 comments on commit 532be4a

Please sign in to comment.