Skip to content

Conversation

@Pragadesh-45
Copy link
Contributor

@Pragadesh-45 Pragadesh-45 commented Jan 1, 2026

fix: #6049

Description

  • Fix elements being lost during WSDL parsing
  • Add support for both xsd: and xs: namespace prefixes in XSD schemas
  • Generate namespace-qualified XML elements (e.g., tns:ElementName)
  • Add xmlns declarations to root elements in SOAP envelopes
  • Fix handling of both element and type references in WSDL messages
  • Prevent element duplication in complex content generation
  • Ensure SOAP-compliant XML output matching industry standards

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.

Summary by CodeRabbit

  • Bug Fixes
    • Improved namespace prefix handling in generated XML samples for better WSDL compatibility.
    • Enhanced SOAP envelope generation to correctly handle both element- and type-referenced message parts.
    • Fixed infinite recursion prevention for complex nested structures.
    • Strengthened error handling for missing elements or types with graceful fallbacks.

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

…port

- Fix elements being lost during WSDL parsing
- Add support for both xsd: and xs: namespace prefixes in XSD schemas
- Generate namespace-qualified XML elements (e.g., tns:ElementName)
- Add xmlns declarations to root elements in SOAP envelopes
- Fix handling of both element and type references in WSDL messages
- Prevent element duplication in complex content generation
- Ensure SOAP-compliant XML output matching industry standards
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 1, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The PR refactors WSDL-to-Bruno conversion by introducing getXsdNode() helper to uniformly handle xsd: and xs: namespace prefix variations, enhancing namespace resolution in sample generation, and improving element/type discovery throughout the parser and sample generator to resolve schema element lookup failures during WSDL import.

Changes

Cohort / File(s) Summary
Namespace-aware XSD node access
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
Added getXsdNode(parent, nodeName) helper to WSDLParser to uniformly resolve nodes with xsd: or xs: prefixes. Updated schema parsing (complexTypes, simpleTypes, elements, sequences, choices, attributes) and sample generation to use this helper instead of direct property access.
Namespace prefix resolution in samples
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
Introduced getNamespacePrefix(namespace) method in XMLSampleGenerator and namespace state tracking to resolve and apply correct prefixes to generated elements. Updated generateSample, findElement, and related methods to honor namespace logic and avoid duplicative processing.
Root element and isRoot flag handling
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
Modified generateElementSample(element, isRoot = false) signature to control root-specific behaviors: suppress comments for root elements and add xmlns declarations. Propagated flag through element and sample generation call chains.
SOAP envelope and part resolution
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
Enhanced SOAP envelope generation to differentiate between part.element and part.type references, construct appropriate sample structure, and resolve complex types via generator.findComplexType(). Updated RPC-style envelope wrapping.
Recursion and re-processing safeguards
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
Added early-return logic when inline content already exists to prevent redundant processing, and introduced visited-type tracking to prevent infinite recursion during recursive sample generation. Enhanced error handling with placeholder comments for missing elements/types.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

Namespaces dance in prefix disguise,
xsd: and xs: now harmonize.
Elements lost are finally found,
WSDL samples bloom all around! 🌿✨

Pre-merge checks and finishing touches

✅ 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 describes the main changes: fixing element parsing and adding namespace support for WSDL import, matching the core objectives.
Linked Issues check ✅ Passed The code changes directly address issue #6049: fixing element loss during WSDL parsing, adding xsd:/xs: prefix support, generating namespace-qualified XML, adding xmlns declarations, handling element/type references, and preventing duplication—all producing complete usable request bodies instead of placeholder comments.
Out of Scope Changes check ✅ Passed All changes are scoped to WSDL/XSD parsing, namespace handling, and XML sample generation in wsdl-to-bruno.js, directly supporting the objectives of fixing element parsing and namespace support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@Pragadesh-45 Pragadesh-45 marked this pull request as draft January 1, 2026 11:31
Copy link
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: 1

🧹 Nitpick comments (1)
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js (1)

319-385: Consider extracting shared parsing logic.

parseElementInline duplicates much of parseElement's inline type handling. A private helper could reduce this duplication.

🔎 Suggested approach

Extract the common complexType/sequence/choice/all/attribute parsing into a private helper method like _parseInlineContent(element, parsedElement, namespace) and call it from both methods.

📜 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 8e74fa6 and d5d5af4.

📒 Files selected for processing (1)
  • packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
🧰 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-converters/src/wsdl/wsdl-to-bruno.js
🧠 Learnings (1)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/src/wsdl/wsdl-to-bruno.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
🔇 Additional comments (9)
packages/bruno-converters/src/wsdl/wsdl-to-bruno.js (9)

680-686: Solid helper for dual-prefix XSD handling.

Clean abstraction that eliminates repetitive prefix checks throughout the parser. The fallback to unprefixed nodeName is a good defensive measure for edge cases.


700-724: Clean namespace prefix resolution.

Good caching strategy and sensible fallback to tns/tnsN prefixes. The lookup order (cached → existing WSDL prefixes → generate new) is appropriate.


769-809: Well-structured root element handling.

The isRoot flag cleanly separates root-specific behavior (xmlns declarations, no optional comments). Namespace-qualified element names will produce SOAP-compliant output.


917-945: Good guard against duplicate element generation.

The early return when element.elements is populated prevents re-processing already-resolved inline types. The self-reference check at line 938 adds protection against infinite recursion.


1020-1064: Robust handling of element vs type references.

The branching logic correctly handles document-style (part.element) and RPC-style (part.type) WSDL patterns. Namespace resolution from prefixes is properly implemented.


207-235: Consistent use of getXsdNode throughout parsing.

The refactoring properly leverages the new helper. Parsing complex types before elements ensures type references resolve correctly.


428-497: Extension handling properly traverses inheritance.

The recursive call to parseComplexTypeContent for complexContent/extension ensures base type elements and attributes are inherited correctly.


553-565: Clean simple type facet extraction.

Properly handles restriction facets including enumerations, patterns, and length constraints.


692-698: Proper state initialization for namespace tracking.

The namespaceCounter and namespacePrefixes Map provide necessary state for the new prefix generation logic.

Comment on lines +757 to +762
let count = 0;
for (const [key] of this.wsdlData.elements) {
console.log(` ${key}`);
count++;
if (count >= 3) break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug logging before merge.

These console.log statements leak schema details and add noise. They appear to be leftover debug artifacts.

🔎 Proposed fix
-    let count = 0;
-    for (const [key] of this.wsdlData.elements) {
-      console.log(`  ${key}`);
-      count++;
-      if (count >= 3) break;
-    }
     return null;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let count = 0;
for (const [key] of this.wsdlData.elements) {
console.log(` ${key}`);
count++;
if (count >= 3) break;
}
🤖 Prompt for AI Agents
In packages/bruno-converters/src/wsdl/wsdl-to-bruno.js around lines 757 to 762,
the for-loop that prints schema keys (`console.log`) is leftover debug output;
remove the console.log and associated count/break logic so schema details are
not logged (either delete the loop entirely or replace it with a no-op or a
conditional debug logger controlled by a verbose flag if runtime inspection is
required).

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.

WSDL import not working as expected

1 participant