npm.io
0.7.11 • Published 3d ago

@scalar/postman-to-openapi

Licence
MIT
Version
0.7.11
Deps
2
Size
176 kB
Vulns
0
Weekly
235.7K

Postman to OpenAPI Converter

Version Downloads License Discord

Convert Postman collections to the open standard OpenAPI. Free the postman!

Installation

npm install @scalar/postman-to-openapi

Usage

import { convert } from '@scalar/postman-to-openapi'

// Free the postman!
const result = await convert(myPostmanCollection)

console.log(result)
Detect Postman collections

Use isPostmanCollection to decide whether an input string should be parsed as a Postman collection before converting.

import { convert, isPostmanCollection } from '@scalar/postman-to-openapi'

if (isPostmanCollection(input)) {
  const openApiDocument = convert(input)
  console.log(openApiDocument)
}

isPostmanCollection accepts exported collections that do not include info._postman_id as long as they contain a valid Postman schema URL and an item tree.

Community

We are API nerds. You too? Let's chat on Discord: https://discord.gg/scalar

Thank you!

This package is based on the existing postman-to-openapi by @joolfe. We update the code and adapted it to our use case. You might consider our package the modern successor.

Keywords