postman-to-openapi-temp
v1.0.0
Published
Convert postman collection to OpenAPI spec
Downloads
3
Maintainers
Readme
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.