-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
docs(generator): update latest generator documentation #3875
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
docs(generator): update latest generator documentation #3875
Conversation
WalkthroughThe documentation for the Changes
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
✅ Deploy Preview for asyncapi-website ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3875 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 667 667
Branches 113 113
=========================================
Hits 667 667 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
markdown/docs/tools/generator/generator-template.md (2)
486-487: TopicFunction Component InitializationThe snippet initializing the topics details with:
const topicsDetails = getTopics(channels); let functions = '';is straightforward. For large numbers of channels, consider using an array and joining the resulting strings for potentially improved performance/readability.
506-507: Redundant Variable Declaration in getTopicsThe assignment:
const channelsCanSendTo = channels;seems redundant since
channelscould be used directly. Removing this extra alias can simplify the code.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
markdown/docs/tools/generator/generator-template.md(5 hunks)
⏰ Context from checks skipped due to timeout of 180000ms (6)
- GitHub Check: Redirect rules - asyncapi-website
- GitHub Check: Header rules - asyncapi-website
- GitHub Check: Pages changed - asyncapi-website
- GitHub Check: Automerge PR autoapproved by a bot
- GitHub Check: Lighthouse CI
- GitHub Check: Test NodeJS PR - macos-13
🔇 Additional comments (5)
markdown/docs/tools/generator/generator-template.md (5)
125-126: Clear Installation ReminderThe added instruction to navigate to the python-mqtt-client-template directory and run
npm installis clear and helps ensure users install dependencies before proceeding.
261-263: Guidance for Running TestsThe instruction to navigate to the python-mqtt-client-template/test/project directory and run
python test.pyis explicit and useful for validating the generated output.
299-325: Comprehensive Package.json Scripts UpdateThe updated
scriptssection in the package.json is well documented. It clearly describes the roles of the four test scripts and provides a step-by-step guide to their usage. One suggestion is to periodically verify that CLI options (like--outputand--force-write) remain consistent with the latest AsyncAPI CLI specifications.🧰 Tools
🪛 LanguageTool
[uncategorized] ~299-~299: You might be missing the article “a” here.
Context: ...)`} ) } ``` ### 4. Write script to run the test code In **package.json...(AI_EN_LECTOR_MISSING_DETERMINER_A)
495-495: Return Statement in TopicFunctionReturning the concatenated
functionsstring is clear. No changes needed here.
518-519: Return Statement in getTopics FunctionReturning
topicsDetailsis clear and appropriate.
| let topicsDetails = []; | ||
|
|
||
| channelsCanSendTo.forEach((ch) => { | ||
| const topic = {} | ||
| const operationId = ch.operations().filterByReceive()[0].id() | ||
| topic.name = operationId.charAt(0).toUpperCase() + operationId.slice(1) | ||
| topic.topic = ch.address() | ||
| const topic = {}; | ||
| const operationId = ch.operations().filterByReceive()[0].id(); | ||
| topic.name = operationId.charAt(0).toUpperCase() + operationId.slice(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Safety Check for Channel Operations
In the loop:
channelsCanSendTo.forEach((ch) => {
const topic = {};
const operationId = ch.operations().filterByReceive()[0].id();
topic.name = operationId.charAt(0).toUpperCase() + operationId.slice(1);
topic.topic = ch.address();
topicsDetails.push(topic);
});accessing the first element of ch.operations().filterByReceive() assumes the array is non-empty. Consider adding a check (or a fallback) to handle channels that might not have any receive operations, to avoid potential runtime errors.
Updated generator documentation is available and this PR introduces update to generator folder on the website
Summary by CodeRabbit