postman-to-openapi-temp
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Introduction

Every honor that comes from this package belongs entirely to postman-to-openapi. I just made a few changes and publish this package while waiting for the pull request to be accepted by him.

Installation

Using npm:

npm i postman-to-openapi-temp

Using yarn:

yarn add postman-to-openapi-temp

To install as a cli just

npm i postman-to-openapi-temp -g

Quick Usage

As a library

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

// 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

Tags

Nodejs Javascript OpenAPI Postman Newman Collection Transform Convert

License

See the LICENSE file.

Package Sidebar

Install

npm i postman-to-openapi-temp

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

75.5 kB

Total Files

12

Last publish

Collaborators

  • cunkz