Skip to main content

A Python module to convert Postman collections to OpenAPI/Swagger format

Project description

Postman2OpenAPI

A Python module to convert Postman collections to OpenAPI (Swagger) format without any third-party dependencies.

Installation

pip install postman2openapi

Usage

from postman2openapi import PostmanToOpenAPIConverter, read_postman_collection, write_openapi_spec

# Read your Postman collection
collection_data = read_postman_collection("path/to/collection.json")

# Create converter instance
converter = PostmanToOpenAPIConverter()

# Convert to OpenAPI
openapi_spec = converter.parse_postman_collection(collection_data)

# Save as YAML (default) or JSON
write_openapi_spec(openapi_spec, "openapi_spec.yaml")  # For YAML
write_openapi_spec(openapi_spec, "openapi_spec.json", format="json")  # For JSON

Features

  • Converts Postman collections to OpenAPI 3.0.0 specification
  • Supports:
    • Basic request information (URL, method, description)
    • Query parameters
    • Request bodies (JSON and form-data)
    • Path parameters
    • Folder structure
  • No third-party dependencies except PyYAML
  • Outputs in both YAML and JSON formats

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/Pulkit-Py/postman2openapi.git
cd postman2openapi

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created by Pulkit-Py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postman2openapi-1.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postman2openapi-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file postman2openapi-1.0.0.tar.gz.

File metadata

  • Download URL: postman2openapi-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for postman2openapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8ac362e3e9cd9cbc6b07e28d1c225ae6da1751bf69e457cb4ed331158a11f629
MD5 f735f8512493d5351083638e0dc04432
BLAKE2b-256 12c50c2a000b8c926df1785a7586ad72d84f507f192b027a920f9a81cf8f3d22

See more details on using hashes here.

File details

Details for the file postman2openapi-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for postman2openapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86e0910cb7f2854fc73fc48710539a4e0d76089899dd7680df26de734e928213
MD5 bf8c87db82cbe2e5ad9699709a5a57c3
BLAKE2b-256 015e5cbc9cc48bf361d5e22d2b78253af35d1ecceba18b5ca5a79ee87b2fa172

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page