Skip to content

Conversation

@AnvayKharb
Copy link

@AnvayKharb AnvayKharb commented Oct 22, 2025

This fixes #4169
This pull request clarifies the documentation for the protocolVersion field in the AsyncAPI server object, making it clear that this field refers specifically to the version of the underlying communication protocol and not to the AsyncAPI specification or the application's API version.

Documentation improvements for protocolVersion:

  • Updated the description in markdown/docs/concepts/asyncapi-document/structure.md to specify that protocolVersion refers to the underlying communication protocol version, with examples, and clarified its distinction from the AsyncAPI spec or application API version.
  • Improved the description in markdown/docs/reference/specification/v3.0.0.md to reinforce that protocolVersion is about the protocol itself, not the document or API version, and provided guidance to omit the field if the protocol lacks versioning.

Summary by CodeRabbit

  • Documentation
    • Clarified that the protocol version field refers to the underlying communication protocol (examples provided) and may be omitted if the protocol has no versioning concept.
  • New Features
    • Added pagination to the blog list with Previous/Next controls, page count and total posts display; filtering now resets to page 1.

Add explicit clarification that `protocolVersion` refers to the version
of the underlying communication protocol (e.g., AMQP 0.9.1, MQTT 3.1.1),
not the AsyncAPI specification version or application API version.

Updates documentation in:
- markdown/docs/reference/specification/v3.0.0.md
- markdown/docs/concepts/asyncapi-document/structure.md

Closes ambiguity between protocol versioning and API versioning.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

Clarified protocolVersion descriptions in two docs files, added a Next.js TypeScript ambient declarations file, and implemented pagination (state, controls, rendering) in the blog index page.

Changes

Cohort / File(s) Summary
Protocol version docs
markdown/docs/concepts/asyncapi-document/structure.md, markdown/docs/reference/specification/v3.0.0.md
Updated protocolVersion / serverObjectProtocolVersion descriptions to state it refers to the underlying communication protocol version (examples: AMQP 0.9.1, MQTT 3.1.1, HTTP 2.0), distinct from AsyncAPI spec or application API version; noted it may be omitted when protocol has no versioning.
TypeScript Next.js ambient declarations
next-env.d.ts
Added Next.js type references and a reference to generated routes typings (.next/types/routes.d.ts) with a note not to edit the file.
Blog pagination feature
pages/blog/index.tsx
Added POSTS_PER_PAGE, currentPage state, paging handlers, page calculations (totalPages, currentPosts), reset behavior on filtering, and UI controls (Previous/Next, page indicator, total posts).

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant B as BlogPage
  participant S as State (currentPage, filters, posts)

  U->>B: Load blog index
  B->>S: initialize posts, currentPage = 1
  B-->>U: render currentPosts (slice by currentPage)

  U->>B: Click Next / Prev
  B->>S: update currentPage (bounded)
  B-->>U: render new currentPosts

  U->>B: Apply / Clear filter
  B->>S: update filters, reset currentPage = 1
  B-->>U: render filtered currentPosts (page 1)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to pages/blog/index.tsx for pagination edge cases and filter-reset behavior.
  • Verify next-env.d.ts references match project Next.js/route generation outputs.
  • Confirm doc wording matches linked issue intent and does not introduce ambiguity.

Possibly related PRs

Suggested labels

ready-to-merge, 📑 docs, area/docs

Suggested reviewers

  • bandantonio
  • derberg
  • akshatnema
  • sambhavgupta0705
  • thulieblack
  • TRohit20

Poem

🐰
I hopped through docs to make things clear,
Protocols named — no need to fear.
Pages now flip, posts in a row,
Types declared so builds can go.
Hop, hop — concise, and off we go! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR includes two files with changes that are out of scope for issue #4169's objective of clarifying the protocolVersion documentation: next-env.d.ts adds a TypeScript declaration file for Next.js configuration, and pages/blog/index.tsx implements pagination functionality for the blog. These changes are unrelated to the protocolVersion field clarification and should be either removed from this PR or addressed in separate pull requests. Remove the out-of-scope changes (next-env.d.ts and pages/blog/index.tsx) from this PR to maintain focus on the protocolVersion documentation clarification. These changes should be submitted separately if they are necessary for the project, as they are unrelated to issue #4169 and add unnecessary scope to the current review.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "docs: clarify protocolVersion field to distinguish from API versioning" accurately summarizes the primary documentation changes. The changes to both structure.md and v3.0.0.md focus on clarifying that protocolVersion refers to the underlying communication protocol version (e.g., MQTT 3.1.1, AMQP 0.9.1) rather than API or application versioning. The title is concise, clear, and specific enough that reviewers immediately understand the main objective of the PR.
Linked Issues Check ✅ Passed The PR directly addresses all coding requirements from linked issue #4169: it clarifies that protocolVersion refers to the underlying communication protocol version rather than API versioning, provides concrete examples (AMQP 0.9.1, MQTT 3.1.1, HTTP 2.0), distinguishes protocolVersion from AsyncAPI specification and application versions, and advises that the field may be omitted if the protocol has no versioning concept. All documentation changes in structure.md and v3.0.0.md meet the stated objectives of the issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ed50843
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/68fca17c5748040008dc0102
😎 Deploy Preview https://deploy-preview-4500--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 project configuration.

@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d3c31cc) to head (8e0aaf4).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4500   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          778       778           
  Branches       144       144           
=========================================
  Hits           778       778           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 22, 2025

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 35
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-4500--asyncapi-website.netlify.app/

@AnvayKharb
Copy link
Author

AnvayKharb commented Oct 22, 2025

please review @thulieblack @bandantonio

- Implement client-side pagination with 15 posts per page
- Add Previous/Next navigation controls with proper disabled states
- Reset pagination when filtering or clearing filters
- Maintain responsive design consistent with existing blog layout
- Display current page info and total post count
- Improve performance by only rendering visible posts
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: 1

🧹 Nitpick comments (2)
pages/blog/index.tsx (2)

75-85: Consider scrolling to top when page changes.

The pagination logic and boundary checks are correct. However, when users navigate to a different page, they typically expect to see the top of the new content. Without automatic scrolling, users might remain at the bottom of the page and not realize the content has changed.

Consider adding scroll behavior to the handlers:

 const goToNextPage = () => {
   if (currentPage < totalPages) {
     setCurrentPage(currentPage + 1);
+    window.scrollTo({ top: 0, behavior: 'smooth' });
   }
 };

 const goToPreviousPage = () => {
   if (currentPage > 1) {
     setCurrentPage(currentPage - 1);
+    window.scrollTo({ top: 0, behavior: 'smooth' });
   }
 };

Or scroll to a specific element like the blog list:

 const goToNextPage = () => {
   if (currentPage < totalPages) {
     setCurrentPage(currentPage + 1);
+    document.getElementById('main-content')?.scrollIntoView({ behavior: 'smooth' });
   }
 };

41-41: Consider syncing pagination state with URL query parameters.

The current page is stored in local state, which means users who refresh the page or share the URL will lose their page position and return to page 1. Syncing with URL query parameters (e.g., /blog?page=3) would improve UX by:

  • Making page positions shareable
  • Supporting browser back/forward navigation
  • Allowing users to bookmark specific pages

Example implementation:

// Initialize from URL
const [currentPage, setCurrentPage] = useState(() => {
  const pageParam = router.query.page;
  return pageParam ? parseInt(pageParam as string, 10) : 1;
});

// Update handlers to push to URL
const goToNextPage = () => {
  if (currentPage < totalPages) {
    const nextPage = currentPage + 1;
    setCurrentPage(nextPage);
    router.push({ pathname: router.pathname, query: { ...router.query, page: nextPage } }, undefined, { shallow: true });
  }
};
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91b53c6 and ed50843.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • next-env.d.ts (1 hunks)
  • pages/blog/index.tsx (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • next-env.d.ts
🔇 Additional comments (5)
pages/blog/index.tsx (5)

17-196: This file change appears unrelated to the PR objectives.

The PR objectives state this PR is meant to clarify the protocolVersion field in AsyncAPI documentation. However, this file implements blog post pagination functionality, which has no connection to the AsyncAPI documentation clarification.

Consider separating unrelated changes into different PRs to maintain focus and make reviews more straightforward.


17-18: LGTM!

Good practice to define the pagination size as a named constant. The value of 15 posts per page is reasonable for a blog listing.


43-46: LGTM!

Good UX decision to reset to page 1 when applying filters. This prevents users from landing on an empty page if the filtered results have fewer pages than their current page number.


63-63: LGTM!

Consistent with the filter reset behavior. Ensures users return to the first page when clearing filters.


67-72: LGTM!

The pagination calculations are correct and use standard formulas. Edge cases (empty posts, partial pages) are handled properly.

Comment on lines +160 to +195
{totalPages > 1 && (
<div className='mt-12 flex items-center justify-center space-x-4'>
<button
onClick={goToPreviousPage}
disabled={currentPage === 1}
className={`px-6 py-2 rounded-md font-medium transition-all duration-200 ${
currentPage === 1
? 'bg-gray-200 text-gray-400 cursor-not-allowed'
: 'bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2'
}`}
>
Previous
</button>

<div className='flex items-center space-x-2'>
<span className='text-sm text-gray-700'>
Page {currentPage} of {totalPages}
</span>
<span className='text-sm text-gray-500'>
({totalPosts} total posts)
</span>
</div>

<button
onClick={goToNextPage}
disabled={currentPage === totalPages}
className={`px-6 py-2 rounded-md font-medium transition-all duration-200 ${
currentPage === totalPages
? 'bg-gray-200 text-gray-400 cursor-not-allowed'
: 'bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2'
}`}
>
Next
</button>
</div>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add accessibility attributes for pagination controls.

The pagination UI is missing semantic HTML and ARIA attributes that are essential for screen reader users to navigate effectively. The buttons lack proper labels, and the pagination region lacks semantic structure.

Apply these improvements:

 {/* Pagination Controls */}
 {totalPages > 1 && (
-  <div className='mt-12 flex items-center justify-center space-x-4'>
+  <nav className='mt-12 flex items-center justify-center space-x-4' aria-label='Blog pagination'>
     <button
       onClick={goToPreviousPage}
       disabled={currentPage === 1}
+      aria-label='Go to previous page'
       className={`px-6 py-2 rounded-md font-medium transition-all duration-200 ${
         currentPage === 1
           ? 'bg-gray-200 text-gray-400 cursor-not-allowed'
           : 'bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2'
       }`}
     >
       Previous
     </button>
     
-    <div className='flex items-center space-x-2'>
+    <div className='flex items-center space-x-2' aria-live='polite' aria-atomic='true'>
       <span className='text-sm text-gray-700'>
         Page {currentPage} of {totalPages}
       </span>
       <span className='text-sm text-gray-500'>
         ({totalPosts} total posts)
       </span>
     </div>
     
     <button
       onClick={goToNextPage}
       disabled={currentPage === totalPages}
+      aria-label='Go to next page'
       className={`px-6 py-2 rounded-md font-medium transition-all duration-200 ${
         currentPage === totalPages
           ? 'bg-gray-200 text-gray-400 cursor-not-allowed'
           : 'bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2'
       }`}
     >
       Next
     </button>
-  </div>
+  </nav>
 )}

Key improvements:

  • Wrap in <nav> with aria-label for semantic structure
  • Add aria-label to buttons for clear purpose
  • Add aria-live='polite' to page info so screen readers announce page changes
🤖 Prompt for AI Agents
In pages/blog/index.tsx around lines 160 to 195, the pagination markup needs
accessibility improvements: wrap the entire pagination block in a <nav> with an
appropriate aria-label (e.g., "Pagination") to provide semantic structure; add
explicit aria-labels to the Previous and Next buttons (e.g., "Previous page" and
"Next page") and include aria-disabled or keep disabled attribute for disabled
state; and add aria-live="polite" to the page info container (the "Page X of Y /
(N total posts)" text) so screen readers are notified when the page changes.
Ensure the nav contains the existing controls and that the button labels are
descriptive and updated to reflect disabled state for assistive tech.

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]: content of protocolVersion not well specified

2 participants