Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to parser API v3 #387

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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