@readme/postman-to-openapi
v4.1.0
Published
Convert postman collection to OpenAPI spec
Downloads
595,563
Readme
@readme/postman-to-openapi
🛸 Convert Postman Collection v2.1/v2.0 to OpenAPI v3.0.
Or in other words, transform this specification and also this to this one
Installation
Using npm
:
npm i @readme/postman-to-openapi
Using yarn
:
yarn add @readme/postman-to-openapi
Quick Usage
As a library
const postmanToOpenAPI = require('postman-to-openapi')
// Postman collection
const postmanCollection = './path/to/postman/collection.json'
// Output OpenAPI Path
const outputFile = './api/collection.yml'
postmanToOpenAPI(postmanCollection, outputFile, { defaultTag: 'General' })
.then(result => {
console.log(`OpenAPI specs: ${result}`)
})
.catch(err => {
console.log(err)
})
Documentation
All features, usage instructions and help can be found in the Documentation page
Differences from postman-to-openapi
There are some small differences between this library and the postman-to-openapi upstream:
- Does not ship with a CLI component.
- Has protections in place to prevent
undefined
statuses from being set. - Has no
version
property on the exported method to determine which version you're running as this is unnecessary without a CLI component.