Skip to content

import response examples for description only responses in swagger 2.0 convertion#7717

Open
gopu-bruno wants to merge 1 commit intousebruno:mainfrom
gopu-bruno:fix/swagger2-description-only-responses
Open

import response examples for description only responses in swagger 2.0 convertion#7717
gopu-bruno wants to merge 1 commit intousebruno:mainfrom
gopu-bruno:fix/swagger2-description-only-responses

Conversation

@gopu-bruno
Copy link
Copy Markdown
Collaborator

@gopu-bruno gopu-bruno commented Apr 8, 2026

Description

  • Swagger 2.0 responses with only a description (no examples or schema) were silently skipped during import, unlike the OpenAPI 3.0 converter which creates examples for them
  • Added a conversion path that creates Bruno examples with an empty body and no content type for description only responses (e.g., 204 No Content, 404 Not Found)
  • Updated existing test to verify description only responses are now converted with correct status, description, and empty body

Tracker in - JIRA

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.

Summary by CodeRabbit

Bug Fixes

  • Improved conversion of Swagger/OpenAPI responses containing only descriptions. These responses (e.g., 204 No Content) now generate Bruno example entries instead of being skipped during conversion.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af444ccb-d9dc-4c88-aee7-b2890f5e8a2d

📥 Commits

Reviewing files that changed from the base of the PR and between 3b502fd and c1da489.

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

Walkthrough

The PR extends Swagger-to-Bruno response handling to generate example entries for responses with only descriptions (e.g., 204 No Content). Previously, such responses without examples or schema produced no Bruno examples; now they create examples with empty values and appropriate status-code-based metadata.

Changes

Cohort / File(s) Summary
Swagger Response Transformation
packages/bruno-converters/src/openapi/swagger2-to-bruno.js
Added logic to generate Bruno examples for Swagger responses containing only descriptions, using empty exampleValue, ${statusCode} Response naming, and null contentType.
Test Updates
packages/bruno-converters/tests/openapi/swagger2-to-bruno/swagger2-examples.spec.js
Updated test assertions to verify that responses with only descriptions (e.g., 204, 404) now produce defined example entries with correct names, descriptions, and response bodies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #6895: Related to example creation and fallback naming patterns in OpenAPI/Postman converters; complements this PR's handling of description-only responses.

Suggested labels

size/XS

Suggested reviewers

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

Poem

📝 A response with just a name, no body in sight,
Now Bruno knows how to handle it right,
Empty values and descriptions so clear,
204 No Content—finally here! ✨

🚥 Pre-merge checks | ✅ 3
✅ 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 directly describes the main change: adding response example handling for description-only Swagger 2.0 responses, which matches the core implementation across both the converter and test files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

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