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

docs: fix incorrect message reference in operation object example #3700

Closed

Conversation

Manancode
Copy link

@Manancode Manancode commented Feb 17, 2025

Fixes [Docs Bug 🐞 report]: operation object example incorrect #3177

The current example in the documentation references a message from the Components Object, which breaks the rule that messages in an operation must reference messages defined in the channel. This PR fixes the example to reference the message from the channel's messages instead.

  • Updated the channels field example to reference the message from the channel's messages.

Before (Incorrect)
$ref: '#/components/messages/userSignUp'

After (Correct)
$ref: '#/channels/user/messages/userSignUp'

Summary by CodeRabbit

  • Documentation
    • Updated our AsyncAPI documentation to improve clarity by reorganizing message references.
    • Added a new guide on Correlation IDs, outlining implementation steps, best practices, and practical examples for distributed tracing in event-driven systems.

Copy link
Contributor

coderabbitai bot commented Feb 17, 2025

Walkthrough

This pull request includes two factual updates to the AsyncAPI documentation. First, it revises the location of the userSignedUp message reference in the structure document, changing it from the components section to the channels section. Second, it introduces a new tutorial document on correlation IDs that explains their role in distributed tracing within event-driven architectures, complete with YAML examples and a Node.js implementation sample.

Changes

File(s) Change Summary
markdown/.../asyncapi-document/structure.md Updated the reference for the userSignedUp message from #/components/messages/userSignUp to #/channels/user/messages/userSignUp in the user channel.
markdown/.../correlation-ids.md Added a new tutorial document explaining correlation IDs, including definitions, YAML examples, and a Node.js with AMQP implementation sample.

Sequence Diagram(s)

sequenceDiagram
    participant Publisher
    participant Broker
    participant Consumer
    Publisher->>Broker: Publish message with correlation ID
    Broker->>Consumer: Deliver message with correlation ID
    Consumer->>Consumer: Process message and log correlation ID
Loading

Suggested labels

ready-to-merge

Suggested reviewers

  • sambhavgupta0705
  • quetzalliwrites
  • devilkiller-ag
  • asyncapi-bot-eve
  • BhaswatiRoy
  • J0SAL
  • TRohit20

Poem

I'm a little rabbit on the run,
Hopping through docs and having fun.
Updated references and guides so neat,
With correlation IDs making life complete.
Here's to smooth code days, truly a treat! 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 67165c6
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67b3c69b9d271f000866ad4c
😎 Deploy Preview https://deploy-preview-3700--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1b240da) to head (67165c6).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3700   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines          732       732           
=========================================
  Hits           732       732           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
markdown/docs/tutorials/correlation-ids.md (2)

35-78: AsyncAPI YAML Example Accuracy

The YAML example accurately demonstrates an AsyncAPI specification for an order processing service. It clearly defines the channel (order/created), message details (headers and payload), and even provides an example correlation ID.

Suggestion:
Consider adding a brief inline comment or note (perhaps just before the code block) to remind users that this example follows the AsyncAPI 3.0.0 format, which might help those new to the spec.


81-156: Node.js Implementation Example Review

The practical Node.js example is well-crafted. It shows how to:

  • Establish an AMQP connection using amqplib
  • Generate a UUID for the correlation ID
  • Publish a message with the correlation ID in the headers
  • Consume messages and log the correlation ID for tracing

While the sample is clear and instructional, you might consider wrapping asynchronous operations in try/catch blocks for production-grade error handling. Since this is a tutorial, the current level of error handling is acceptable, but adding a note about robust error management in real-world applications can further enhance the guidance.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b240da and 67165c6.

📒 Files selected for processing (2)
  • markdown/docs/concepts/asyncapi-document/structure.md (1 hunks)
  • markdown/docs/tutorials/correlation-ids.md (1 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: Test NodeJS PR - windows-latest
  • GitHub Check: Test NodeJS PR - macos-13
  • GitHub Check: Lighthouse CI
🔇 Additional comments (4)
markdown/docs/tutorials/correlation-ids.md (3)

1-5: Front Matter and Metadata Overview

The front matter block is well-structured and clearly defines the document's title, description, and weight. This metadata sets the context nicely for the tutorial.


7-9: Clear Introduction Section

The "Introduction" section succinctly explains the concept of correlation IDs and their importance in event-driven architectures. This sets an appropriate stage for the detailed content that follows.


158-194: Best Practices and Visual Aids

The "Best Practices" section, complemented by the Mermaid sequence diagram, provides valuable guidance on generating, propagating, and utilizing correlation IDs. The inclusion of practical tips (e.g., generating IDs early, consistently propagating them, and incorporating them into logs) is very useful for users.

markdown/docs/concepts/asyncapi-document/structure.md (1)

461-463: Message Reference Update Validation

The updated reference for the userSignedUp message—from #/components/messages/userSignedUp to #/channels/user/messages/userSignUp—correctly aligns with the AsyncAPI guidelines. This change ensures that the message is now correctly associated with the channel context rather than the components object. Great fix that addresses the issue raised in the bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs Bug 🐞 report]: operation object example incorrect
1 participant