Skip to content

fix:populate collection & folder docs on OpenAPI/swagger imports#8767

Open
adwait-bruno wants to merge 1 commit into
usebruno:mainfrom
adwait-bruno:feat/openapi-drop-collection
Open

fix:populate collection & folder docs on OpenAPI/swagger imports#8767
adwait-bruno wants to merge 1 commit into
usebruno:mainfrom
adwait-bruno:feat/openapi-drop-collection

Conversation

@adwait-bruno

@adwait-bruno adwait-bruno commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

REF:BRU-1429

OpenAPI import only copied request-level descriptions into Docs tabs,info.description (collection) and top-level tags[].description (folders)were never read, leaving those Docs tabs empty.

Read info.description into collection root docs and match top-level tags[] descriptions to their folders via a shared getTagDescriptions helper (keyed by sanitized tag name so it lines up with folder names).Applied to both the OpenAPI 3.x and Swagger 2.0 converters.

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.

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.
Collection-Level:
image
Folder-Level:
image

Summary by CodeRabbit

  • New Features

    • OpenAPI and Swagger 2.0 imports now preserve collection descriptions as documentation.
    • Tag descriptions are added to matching generated folders.
    • Markdown formatting and existing request documentation are preserved.
  • Bug Fixes

    • Documentation remains correctly assigned when grouping requests by path.
    • Missing descriptions no longer create empty documentation entries.
  • Tests

    • Added coverage for collection, folder, request, sanitization, and missing-description scenarios.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

OpenAPI and Swagger 2.0 converters now import collection descriptions and tag descriptions into generated Bruno collections and folders. A shared sanitized tag-description helper supports both converters, with Jest coverage for populated, missing, and preserved documentation.

Changes

OpenAPI documentation import

Layer / File(s) Summary
Tag description mapping
packages/bruno-converters/src/openapi/openapi-common.js
Adds getTagDescriptions, which maps sanitized tag names to descriptions.
OpenAPI converter docs
packages/bruno-converters/src/openapi/openapi-to-bruno.js, packages/bruno-converters/tests/openapi/openapi-to-bruno/*
Populates collection and tag-folder docs fields and tests sanitization, markdown preservation, missing descriptions, and request-level docs.
Swagger converter docs
packages/bruno-converters/src/openapi/swagger2-to-bruno.js, packages/bruno-converters/tests/openapi/swagger2-to-bruno/*
Populates collection and tag-folder docs fields for Swagger 2.0 and tests missing-description handling and request-level docs preservation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • usebruno/bruno#8761: Adds the same shared tag-description mapping and converter documentation coverage.

Suggested reviewers: bijin-bruno

Poem

Tags find their folders, descriptions take flight,
Collections gather their docs just right.
Markdown stays crisp, names sanitize clean,
Tests guard the paths in the conversion scene.
OpenAPI and Swagger now write what they mean.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: populating collection and folder docs during OpenAPI and Swagger imports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js (1)

99-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert absent collection docs exactly.

The current predicates accept null or '', so a converter that emits docs rather than leaving them unset still passes. Assert toBeUndefined() in both suites.

  • packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js#L99-L105: replace the permissive root-doc assertion with expect(result.root.docs).toBeUndefined().
  • packages/bruno-converters/tests/openapi/swagger2-to-bruno/swagger2-docs.spec.js#L81-L87: replace the permissive root-doc assertion with expect(result.root.docs).toBeUndefined().
🤖 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-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js`
around lines 99 - 105, In the no-description documentation tests, require root
docs to be absent exactly: update the root assertion in
packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js
lines 99-105 and
packages/bruno-converters/tests/openapi/swagger2-to-bruno/swagger2-docs.spec.js
lines 81-87 to use toBeUndefined(), while preserving the existing folder-doc
assertions.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In
`@packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js`:
- Around line 99-105: In the no-description documentation tests, require root
docs to be absent exactly: update the root assertion in
packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js
lines 99-105 and
packages/bruno-converters/tests/openapi/swagger2-to-bruno/swagger2-docs.spec.js
lines 81-87 to use toBeUndefined(), while preserving the existing folder-doc
assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 23cec2df-3d46-47d9-a1cc-a356089f6a54

📥 Commits

Reviewing files that changed from the base of the PR and between 1c49123 and badcb0b.

📒 Files selected for processing (5)
  • packages/bruno-converters/src/openapi/openapi-common.js
  • packages/bruno-converters/src/openapi/openapi-to-bruno.js
  • packages/bruno-converters/src/openapi/swagger2-to-bruno.js
  • packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-docs.spec.js
  • packages/bruno-converters/tests/openapi/swagger2-to-bruno/swagger2-docs.spec.js

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.

1 participant