Files
bruno/packages/bruno-converters
Abhishek S Lal 4d17809562 enhance OpenAPI sync with validation, enum support, and bug fixes (#7408)
* Enhance OpenAPISyncTab functionality with error handling and UI improvements

- Updated ConnectSpecForm to include error handling for invalid OpenAPI specifications when uploading files.
- Added a sync info notice in CollectionStatusSection to inform users about tracked changes.
- Improved styling in StyledWrapper for better visual feedback and layout consistency.
- Adjusted button colors and properties in ConfirmSyncModal and ConnectionSettingsModal for better UX.
- Refactored useOpenAPISync hook to validate URLs before syncing, ensuring only valid OpenAPI specs are processed.
- Enhanced parameter handling in openapi-to-bruno.js to support enum and default values more effectively.

* Refactor OpenAPISyncTab components for improved URL validation and error handling

- Updated ConnectSpecForm to streamline file upload error handling for OpenAPI specifications.
- Enhanced OpenAPISyncHeader to utilize isHttpUrl for better URL validation.
- Refactored useOpenAPISync hook to replace isValidUrl with isHttpUrl for consistency in URL checks.
- Improved file parsing logic in file-reader.js to handle case-insensitive JSON file extensions.
- Added isHttpUrl utility function to validate HTTP/HTTPS URLs effectively.

* Enhance file parsing logic in file-reader.js to improve error handling for JSON and YAML files

- Updated parseFileAsJsonOrYaml function to handle case-insensitive JSON file extensions more robustly.
- Added error handling to ensure the document root is an object and not an array, improving data validation.

* Update StatusBadge component to include new 'xs' size preset and adjust documentation accordingly

- Added 'xs' size preset with specific font size and padding for minimal use cases.
- Updated documentation to reflect the new size options available for the StatusBadge component.
2026-03-10 17:15:45 +05:30
..
2025-12-04 01:37:20 +05:30
2025-12-04 01:37:20 +05:30
2025-12-04 01:37:20 +05:30

bruno-converters

The converters package is responsible for converting collections from one format to a Bruno collection. It can be used as a standalone package or as a part of the Bruno framework.

Installation

npm install @usebruno/converters

Usage

Convert Postman collection to Bruno collection

const { postmanToBruno } = require('@usebruno/converters');

// Convert Postman collection to Bruno collection
const brunoCollection = postmanToBruno(postmanCollection);

Convert Postman Environment to Bruno Environment

const { postmanToBrunoEnvironment } = require('@usebruno/converters');

const brunoEnvironment = postmanToBrunoEnvironment(postmanEnvironment);

Convert Insomnia collection to Bruno collection

const { insomniaToBruno } = require('@usebruno/converters');

const brunoCollection = insomniaToBruno(insomniaCollection);

Convert OpenAPI specification to Bruno collection

const { openApiToBruno } = require('@usebruno/converters');

const brunoCollection = openApiToBruno(openApiSpecification);

Convert WSDL file to Bruno collection

import { wsdlToBruno } from '@usebruno/converters';

const brunoCollection = await wsdlToBruno(wsdlContent);

Example


const { postmanToBruno } = require('@usebruno/converters');
const fs = require('fs/promises');
const path = require('path');

async function convertPostmanToBruno(inputFile, outputFile) {
  try {
    // Read Postman collection file
    const inputData = await fs.readFile(inputFile, 'utf8');
    
    // Convert to Bruno collection
    const brunoCollection = await postmanToBruno(JSON.parse(inputData));
    
    // Save Bruno collection
    await fs.writeFile(outputFile, JSON.stringify(brunoCollection, null, 2));
    
    console.log('Conversion successful!');
  } catch (error) {
    console.error('Error during conversion:', error);
  }
}

// Usage
const inputFilePath = path.resolve(__dirname, 'demo_collection.postman_collection.json');
const outputFilePath = path.resolve(__dirname, 'bruno-collection.json');

convertPostmanToBruno(inputFilePath, outputFilePath);

WSDL Import Features

The WSDL importer supports the following features:

  • Service Discovery: Automatically extracts service endpoints from WSDL definitions
  • Operation Mapping: Converts WSDL operations to Bruno HTTP requests
  • SOAP Envelope Generation: Creates proper SOAP envelopes for each operation
  • Header Configuration: Sets up appropriate Content-Type and SOAPAction headers
  • Environment Variables: Creates environment variables for service base URLs
  • Folder Organization: Groups operations by port type for better organization

WSDL Import Example

import { wsdlToBruno } from '@usebruno/converters';
import fs from 'fs/promises';

async function importWSDL() {
  try {
    // Read WSDL file
    const wsdlContent = await fs.readFile('service.wsdl', 'utf8');
    
    // Convert to Bruno collection
    const brunoCollection = await wsdlToBruno(wsdlContent);
    
    // Save Bruno collection
    await fs.writeFile('soap-collection.json', JSON.stringify(brunoCollection, null, 2));
    
    console.log('WSDL import successful!');
  } catch (error) {
    console.error('Error during WSDL import:', error);
  }
}

importWSDL();

CLI Usage

You can also use the Bruno CLI to import WSDL files:

# Import WSDL file to a directory
bruno import wsdl --source service.wsdl --output ~/Desktop/soap-collection --collection-name "SOAP Service"

# Import WSDL from URL
bruno import wsdl --source https://example.com/service.wsdl --output ~/Desktop --collection-name "Remote SOAP Service"

# Import WSDL and save as JSON file
bruno import wsdl --source service.wsdl --output-file ~/Desktop/soap-collection.json --collection-name "SOAP Service"

Supported Formats

  • Postman Collections (v2.1)
  • Insomnia Collections (v4 and v5)
  • OpenAPI Specifications (v3.0)
  • WSDL Files (Web Services Description Language)

Dependencies

  • lodash - Utility functions
  • nanoid - UUID generation
  • js-yaml - YAML parsing
  • xml2js - XML parsing for WSDL
  • @usebruno/schema - Schema validation