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 3 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
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.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"yaml": "^1.10.2"
},
"devDependencies": {
"@asyncapi/parser": "^3.0.0-next-major-spec.12",
"@asyncapi/cli": "^0.60.4",
"@asyncapi/parser": "^3.0.0-next-major-spec.3",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@types/react": "^18.2.18",
Expand All @@ -57,8 +57,8 @@
},
"generator": {
"renderer": "react",
"apiVersion": "v2",
"generator": ">=1.13.0 <2.0.0",
"apiVersion": "v3",
"generator": ">=1.15.0 <2.0.0",
"parameters": {
"frontMatter": {
"description": "The name of a JSON or YAML formatted file containing values to provide the YAML frontmatter for static-site or documentation generators. The file may contain {{title}} and {{version}} replaceable tags.",
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
Loading