Convert postman collection to OpenAPI spec
npm install @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



Using npm:
``bash`
npm i @readme/postman-to-openapi
Using yarn:
`bash`
yarn add @readme/postman-to-openapi
As a library
`js
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)
})
All features, usage instructions and help can be found in the Documentation page
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.version` property on the exported method to determine which version you're running as this is unnecessary without a CLI component.
* Has no