JSPM

postman-ke-openapi

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 342
  • Score
    100M100P100Q92631F
  • License MIT

Convert postman collection to OpenAPI spec

Package Exports

  • postman-ke-openapi
  • postman-ke-openapi/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postman-ke-openapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Installation

Using npm:

npm i postman-ke-openapi

Using yarn:

yarn add postman-ke-openapi

To install as a cli just

npm i postman-ke-openapi -g

Quick Usage

As a library

// Require Package
const postmanToOpenApi = require('postman-ke-openapi')

// Postman Collection Path
const postmanCollection = './path/to/postman/collection.json'
// Output OpenAPI Path
const outputFile = './api/collection.yml'

// Async/await
try {
    const result = await postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' })
    // Without save the result in a file
    const result2 = await postmanToOpenApi(postmanCollection, null, { defaultTag: 'General' })
    console.log(`OpenAPI specs: ${result}`)
} catch (err) {
    console.log(err)
}

// Promise callback style
postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' })
    .then(result => {
        console.log(`OpenAPI specs: ${result}`)
    })
    .catch(err => {
        console.log(err)
    })

As a cli

p2o ./path/to/PostmantoCollection.json -f ./path/to/result.yml -o ./path/to/options.json

Cli Demo

cli demo gif

Documentation

All features, usage instructions and help can be found in the Documentation page

Credits

All credits goes to joolfe. I re-publish this package because my PR didnt get any response.

Tags

Nodejs Javascript OpenAPI Postman Newman Collection Transform Convert

License

See the LICENSE file.