Skip to content

Feature: Object Variable Interpolation#6317

Merged
bijin-bruno merged 3 commits intousebruno:mainfrom
TheUnCola:feat/object-variable-interpolate
Feb 16, 2026
Merged

Feature: Object Variable Interpolation#6317
bijin-bruno merged 3 commits intousebruno:mainfrom
TheUnCola:feat/object-variable-interpolate

Conversation

@TheUnCola
Copy link
Copy Markdown
Contributor

@TheUnCola TheUnCola commented Dec 4, 2025

Description

Adds object interpolation to {{variables}} in a request body. Reduces time for consumers by not having to swap back and forth between the variables page and a request to see the data in a variable object.

Variable:
image
image

Problem:
image

Solution:
image

Now that the contents of the object are visible, dot notation can be used to grab any value from that object:
image

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request. Object Variable Interpolation #6316

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes

    • Preserve and correctly display numeric zero values in variable info
  • Improvements

    • Wider display area for variable values in the editor
    • Better wrapping and whitespace preservation for long or formatted text
    • Improved pretty-printing and empty-value handling for object/undefined values

✏️ Tip: You can customize this high-level summary in your review settings.

Added styling changes to accommodate objects
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 4, 2025

Walkthrough

CSS for the CodeMirror variable info display was adjusted (wrapping and max-width) and brunoVarInfo updateValueDisplay was changed to explicitly handle objects, undefined, and preserve falsy values like 0.

Changes

Cohort / File(s) Summary
CSS display styling
packages/bruno-app/src/globalStyles.js
Replaced word-break with overflow-wrap, added white-space: pre-wrap, and increased .CodeMirror-brunoVarInfo .var-value-display max-width from 13.1875rem to 17.1875rem to change wrapping behavior and allow wider content.
Value display rendering logic
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
Updated non-secret value rendering to early-return for undefined, preserve 0, pretty-print objects via JSON.stringify(value, null, 2), and avoid using `value

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect brunoVarInfo.updateValueDisplay for edge cases (Date, Error, circular objects, large objects) and CodeMirror compatibility with the pretty-printed string.
  • Verify UI layout around .CodeMirror-brunoVarInfo .var-value-display at the increased width to ensure no overflow or visual regressions.

Possibly related issues

Possibly related PRs

Suggested labels

size/XS

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

Zero stands proud and text no longer breaks,
Objects show structure, not opaque mistakes.
Whitespace kept, the width grows wide—
Small tweaks that make the variables smile inside. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature: Object Variable Interpolation' directly describes the main feature being added—enabling object interpolation for variables in request bodies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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
Copy Markdown
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)
packages/bruno-app/src/globalStyles.js (1)

323-334: Updated wrapping/max-width works for pretty-printed values; consider aligning widths with editable view

The switch to overflow-wrap: break-word + white-space: pre-wrap and the wider max-width is a good fit for multi-line JSON/object values and should avoid mid-word breaks.

One minor polish to consider: .var-value-display now uses max-width: 17.1875rem, while .var-value-editable-display and the editor internals still cap at 13.1875rem. If the intent is to have read-only and editable views feel identical in width, it may be worth standardizing these values in a follow-up.

packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)

88-93: Display logic now correctly handles 0 and objects; consider a small follow-up for masked values

The new updateValueDisplay logic is a clear improvement:

  • Preserves 0 instead of treating it as empty.
  • Pretty-prints objects via JSON.stringify(value, null, 2), which matches the new white-space: pre-wrap styling.

One follow-up you might consider (non-blocking): getMaskedDisplay still uses (value || '').length, so masked values that are 0 or plain objects (without a length property) end up with an empty mask. If you expect secrets or masked vars to be numbers/objects as well, switching to something like String(value ?? '').length would make the masking consistent with this new display behavior.

📜 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 b18d582 and 942186f.

📒 Files selected for processing (2)
  • packages/bruno-app/src/globalStyles.js (1 hunks)
  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation, never tabs
Use single quotes for strings instead of double quotes
Always add semicolons at the end of statements
No trailing commas in code
Always use parentheses around parameters in arrow functions, even for single parameters
For multiline constructs, put opening braces on the same line with a minimum of 2 elements for multiline formatting
No newlines inside function parentheses
Space before and after the arrow in arrow functions: () => {}
No space between function name and parentheses: func() not func ()
Semicolons should go at the end of the line, not on a new line
Function names should be concise and descriptive
Add JSDoc comments to provide details to abstractions
Avoid single-line abstractions where all that is being done is increasing the call stack with one additional function
Add meaningful comments to explain complex code flow instead of obvious comments

Files:

  • packages/bruno-app/src/globalStyles.js
  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
🧬 Code graph analysis (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)
packages/bruno-app/src/utils/common/codemirror.js (1)
  • value (8-8)

valueDisplay.textContent = getMaskedDisplay(value);
} else {
valueDisplay.textContent = value || '';
valueDisplay.textContent = !value && value !== 0 ? '' : typeof value === 'object' ? JSON.stringify(value, null, 2) : value;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
valueDisplay.textContent = !value && value !== 0 ? '' : typeof value === 'object' ? JSON.stringify(value, null, 2) : value;
switch (typeof value) {
case 'undefined':
case 'function':
valueDisplay.textContent = typeof value;
case 'object':
valueDisplay.textContent = value === null ? 'null' : JSON.stringify(value, null, 2);
default:
valueDisplay.textContent = String(value);
}

I feel like using a switch to cover all possible values/edge-cases would be better for values like null, undefined etc.

Copy link
Copy Markdown
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 (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)

99-99: Redundant undefined check.

The condition typeof value === 'undefined' || value === undefined is redundant. The second check is always true if the first check is true.

Apply this diff to simplify:

-  if (typeof value === 'undefined' || value === undefined) {
+  if (typeof value === 'undefined') {
     valueDisplay.textContent = '';
     return;
   }
📜 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 942186f and bd0fb05.

📒 Files selected for processing (1)
  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
🧬 Code graph analysis (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)
packages/bruno-app/src/utils/common/codemirror.js (1)
  • value (8-8)
🔇 Additional comments (2)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (2)

94-97: LGTM! Object handling is well-implemented.

The explicit handling for objects (null vs. non-null) with JSON.stringify provides clear, readable output for variable values. This aligns perfectly with the PR objective to make object contents visible inline.


88-105: Clean control flow with early returns.

The refactored logic correctly handles all value types:

  • Secret/masked values (with early return)
  • Objects (null vs. stringified)
  • Undefined (cleared display)
  • Primitives (preserving falsy values like 0)

The early return pattern is readable and avoids the pitfalls of the old value || '' approach.

@bijin-bruno bijin-bruno merged commit 8724201 into usebruno:main Feb 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants