feat(ws): add protobuf body mode for websocket messages#7936
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughProtobuf support is added as a new WebSocket request body mode. RAW_MODES and TYPE_BY_DECODER register the mode; CodeMirror configuration maps it to a syntax mode; humanizeRequestBodyMode provides a "PROTOBUF" label; the Format (prettify) button is now enabled only for JSON or XML. ChangesProtobuf Body Mode
Sequence Diagram(s) sequenceDiagram
participant User as User UI
participant Single as SingleWSMessage
participant CM as CodeMirrorConfig
participant Util as humanizeRequestBodyMode
User->>Single: select protobuf mode / open editor
Single->>CM: request codemirror mode for 'protobuf'
CM-->>Single: return editor mode
Single->>Util: request human label for 'protobuf'
Util-->>Single: return "PROTOBUF"
Single->>Single: compute codeType -> (not json/xml)
Single-->>User: Prettify button disabled
🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js (1)
104-143:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
onPrettifysilently does nothing forprotobuf— no user feedback.The wand button is visible and clickable when
protobufis selected, butonPrettifyonly handlesjsonandxml. Clicking it for a protobuf message produces no action and no toast, leaving the user wondering if it worked.Either disable the prettify button when
codeType === 'protobuf', or add a toast informing the user it's not supported.🛠️ Quick fix — disable prettify for unsupported types
- <ToolHint text="Format" toolhintId={`prettify-msg-${index}`}> - <button onClick={onPrettify} className="toolbar-btn"> - <IconWand size={16} strokeWidth={1.5} /> - </button> - </ToolHint> + <ToolHint text="Format" toolhintId={`prettify-msg-${index}`}> + <button + onClick={onPrettify} + className="toolbar-btn" + disabled={!['json', 'xml'].includes(codeType)} + > + <IconWand size={16} strokeWidth={1.5} /> + </button> + </ToolHint>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js` around lines 104 - 143, onPrettify currently handles only json and xml, leaving protobuf clicks silent; either disable the prettify button in the SingleWSMessage render when codeType === 'protobuf' or add an explicit branch in onPrettify to call toastError (e.g., toastError(new Error('Prettify not supported for protobuf'))) so users get feedback; locate the handler onPrettify and the prettify button click wiring in SingleWSMessage, and update either the button's disabled prop when codeType === 'protobuf' or add an else-if (codeType === 'protobuf') branch that calls toastError.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js`:
- Around line 97-102: Update the codemirrorMode mapping so the protobuf entry
uses text/plain instead of application/ld+json: locate the codemirrorMode
constant and change the 'protobuf' key's value from 'application/ld+json' to
'text/plain' (this ensures protobuf messages fall back to plain text
highlighting in the SingleWSMessage component).
---
Outside diff comments:
In
`@packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js`:
- Around line 104-143: onPrettify currently handles only json and xml, leaving
protobuf clicks silent; either disable the prettify button in the
SingleWSMessage render when codeType === 'protobuf' or add an explicit branch in
onPrettify to call toastError (e.g., toastError(new Error('Prettify not
supported for protobuf'))) so users get feedback; locate the handler onPrettify
and the prettify button click wiring in SingleWSMessage, and update either the
button's disabled prop when codeType === 'protobuf' or add an else-if (codeType
=== 'protobuf') branch that calls toastError.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9ccc1c19-53fb-4ca3-bb66-7529ee4e530a
📒 Files selected for processing (3)
packages/bruno-app/src/components/RequestPane/WsBody/BodyMode/index.jspackages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.jspackages/bruno-app/src/utils/collections/index.js
|
Thank you, i have addressed both points:
-
changed protobuf editor mode fallback to text/plain
-
disabled the prettify action for unsupported message types
…On Thu, May 7, 2026 at 9:13 AM coderabbitai[bot] ***@***.***> wrote:
***@***.***[bot]* commented on this pull request.
*Actionable comments posted: 1*
Caution
Some comments are outside the diff and can’t be posted inline due to
platform limitations.
|
Description
Adds
PROTOBUFas a selectable body mode for WebSocket messages.This improves consistency between WebSocket and gRPC workflows by allowing protobuf-formatted WebSocket payloads to be selected and displayed correctly in the editor UI.
Changes
PROTOBUFoption to the WebSocket body mode dropdownhumanizeRequestBodyModeScreenshot
Contribution Checklist:
Summary by CodeRabbit
New Features
Improvements