Repository navigation
fix(bruno-converters): serialize Postman GraphQL variables to JSON st… - #9635
sahilshingate01 wants to merge 1 commit into
Conversation
…ring and guard null prototype
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Normalize GraphQL values and verify imports packages/bruno-converters/src/postman/postman-to-bruno.js, packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js |
The parser returns empty values for falsy input, skips null and empty-string fields, serializes object variables as JSON, and converts other non-string values to strings. Tests cover these cases and null-prototype input. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- usebruno/bruno#9602: Both changes address GraphQL variable handling. This converter prepares values consumed by the downstream comment-stripping step.
Suggested labels: size/L
Suggested reviewers: sanish-bruno, lohit-bruno
Merge Risk: 
Minimal · up to c9865
-
No actionable issue is identified for the GraphQL import change; it is mergeable after normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Queries meet their string-shaped form
Object variables take JSON form
Null fields leave an empty space
Tests check each imported case
GraphQL finds a steady path
Comment @coderabbitai help to get the list of available commands.
Description
Fixes a runtime crash when executing GraphQL requests imported from Postman collections by ensuring GraphQL
variablesare stringified, and safely guardsparseGraphQLRequestagainst null-prototype sources.Problem
parseGraphQLRequestdirectly assigned the object tobrunoRequestItem.request.body.graphql.variables. During execution,prepare-request.jspasses variables todecomment(vars || '{}'), which throwsTypeError: Input must be a string, crashing the runner.parseGraphQLRequestcalledgraphqlSource.hasOwnProperty(...)directly. IfgraphqlSourcelackedObject.prototype(e.g.Object.create(null)), an uncaught TypeError was thrown, losing query and variable data.Fix
parseGraphQLRequestinpackages/bruno-converters/src/postman/postman-to-bruno.jsto serialize object variables to formatted JSON strings (JSON.stringify(..., null, 2)).Object.prototype.hasOwnProperty.call(graphqlSource, ...)for bothvariablesandquery.packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.jsvalidating conversion of object variables, string variables, null variables, and null-prototype sources.Summary by CodeRabbit