1.0.1 • Published 12 months ago

postman-ke-openapi v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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.