Repository navigation
feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion - #7644
Conversation
… Postman to Bruno conversion - Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string. - Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields. - Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ 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 due to trivial changes (1)
WalkthroughAdded an Changes
Sequence Diagram(s)(omitted — changes are limited to normalization helper and tests; no new multi-component control flow requiring sequence diagrams) Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
…formation - Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process. - The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js (1)
818-818: Nit: Missing newline before the new test.There's no blank line separating the previous test's closing brace from the new test. The surrounding tests have consistent blank line separation.
Suggested fix
}); + it('should convert numeric values to strings in headers, params, and body fields', async () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js` at line 818, Add a single blank line separating the previous test's closing brace and the new test declaration so tests match the surrounding style; insert a newline between the prior test's closing "}" and the next "test(...)"/ "it(...)" block to maintain consistent blank-line separation.packages/bruno-converters/src/postman/postman-to-bruno.js (1)
171-180: Consider usingensureStringhere for consistency.The inline logic at line 175 duplicates the null/string/object handling that
ensureStringnow provides. You could simplify:- value: v.value == null ? '' : typeof v.value === 'string' ? v.value : JSON.stringify(v.value), + value: ensureString(v.value),This would unify all value normalization under a single helper.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 171 - 180, The mapping in importCollectionLevelVariables currently normalizes variable values inline (the ternary at the value property) and duplicates logic; replace that inline normalization with a call to the existing ensureString helper (use ensureString(v.value)) so all value conversion (null/object/string) is centralized; update the value assignment in the vars mapping inside importCollectionLevelVariables to use ensureString and keep uid, name, enabled logic the same.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 171-180: The mapping in importCollectionLevelVariables currently
normalizes variable values inline (the ternary at the value property) and
duplicates logic; replace that inline normalization with a call to the existing
ensureString helper (use ensureString(v.value)) so all value conversion
(null/object/string) is centralized; update the value assignment in the vars
mapping inside importCollectionLevelVariables to use ensureString and keep uid,
name, enabled logic the same.
In
`@packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js`:
- Line 818: Add a single blank line separating the previous test's closing brace
and the new test declaration so tests match the surrounding style; insert a
newline between the prior test's closing "}" and the next "test(...)"/ "it(...)"
block to maintain consistent blank-line separation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: de22eec7-9ccb-40ea-96b8-5a5eae4ed1ca
📒 Files selected for processing (2)
packages/bruno-converters/src/postman/postman-to-bruno.jspackages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js
… to Bruno transformation - Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process. - The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.
… Postman to Bruno conversion (#7644) * feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion - Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string. - Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields. - Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields. * test: add test for numeric value conversion in Postman to Bruno transformation - Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process. - The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion. * test: add multipart form value test for numeric conversion in Postman to Bruno transformation - Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process. - The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.
… Postman to Bruno conversion (usebruno#7644) * feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion - Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string. - Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields. - Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields. * test: add test for numeric value conversion in Postman to Bruno transformation - Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process. - The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion. * test: add multipart form value test for numeric conversion in Postman to Bruno transformation - Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process. - The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.
Jira
ensureStringfunction to convert numeric and non-string values to strings, defaulting null/undefined to an empty string.importPostmanV2CollectionItemto utilizeensureStringfor headers, parameters, and body fields.Description
Contribution Checklist:
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
Tests