Reading:
Postman To Swagger

Postman To Swagger

Metamug
Postman To Swagger

No Swagger Export option in Postman

Postman doesn't allow the option to download the APIs into OpenAPI format AKA swagger specs. You can only download the APIs in postman collection format.

Postman Collections

Postman has its own format for saving the API specs. They call it Postman Collection.

All the APIs we test and document are stored in Postman Collection format. Postman collection is a json format.

The current version is 2.1 and they have provided a converter to migrate from version v1 to v2

postman-collection-transformer convert \
    --input ./v1-collection.json \
    --input-version 1.0.0 \
    --output ./v2-collection.json 
    --output-version 2.0.0 \
    --pretty \
    --overwrite

The Open API Standard

Swagger has graduated to become the Open API. Before Open API, different tools had their own format for describing APIs like raml, postman collections etc.

They have provided the reverse option of importing Open API into Postman collection and it makes sense as Postman should have the ability to import swagger specs generated by code.

Here Postman team explains how Postman has adopted the open standard. Storing postman collection in the form of Open API is the standard way of documenting your API.

What are your options?

Coming back to our question, how do we convert Postman Collections.

Top google results show API Transform. Now that is a paid service. Why pay for converting a format to an open standard (Open API)

On this stackoverflow question

The following options are listed.

  • API Matic - Note that the site requires an account to be created to use
  • Rest United - only free if one has <=5 endpoints per API and <=3 APIs.
  • API Spec Converter - Only works with postman V1

Solution

The project by Joolfe is one of the best ways to convert Postman to swagger

I have personally tested the code and found it most effective for converting to Open API.

The command line tool allows to easily convert Postman Collections V2.0 JSON to Open API 3.0 yaml

p2o ./path/to/PostmantoCollection-2.json -f ./path/to/open-api-3.0.yml


Comments

Post a comment
Icon For Arrow-up