Postman to OpenAPI

Postman to OpenAPI online

Hi folks! In this blog post, I'm going to introduce you to an easy way to convert Postman collections to OpenAPI schema in just one click. To see it in action, go to p2o.defcon007.com

What is OpenAPI schema?

According to Wikipedia, OpenAPI Specification, previously known as the Swagger Specification, is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services.

It provides a standard way to share your API designs with others, and even auto-generate documentations using various tools.

If you try to write an OpenAPI schema file for your service, one of the major challenges you will face is remembering the structure and ways in which different entities are described in the specification. Tools like Postman, makes it very easy to test your endpoints by writing requests and grouping them together inside collections. The ease of use and intuitiveness of the tool makes it very easy to define all the endpoints inside Postman collections, but creating an OpenAPI schema manually for all the endpoints is very cumbersome.

I always find it very easy to create a collection for my service and use it during the development itself for testing purpose. There are solutions already present to convert the collection to OpenAPI schema, but most of them are CLI tools. I wanted a quick way to convert the collection to OpenAPI schema. I was also reading about Next.js at the time and wanted to try it out.

Hence, Postman to OpenAPI online was born. It is a small online utility powered by Next.js to convert Postman collections to OpenAPI schema file. For data privacy reasons, all the conversion happens inside your browser keeping all of your data safe.

You can either load the collection from an exported JSON or directly use the collection URL.

Note: If your collection is not public, create an access token in Postman and add ?apikey=<POSTMAN_API_KEY> at end of the URL to access it.

Now, to generate the OpenAPI schema

Demo

Convert collection JSON file to OpenAPI schema

Convert Postman collection file to OpenAPI

Convert collection via URL to OpenAPI schema

Convert Postman collection URL to OpenAPI

Thank you for reading! Head over to https://github.com/DefCon-007/postman-to-openapi-online to contribute to the source code.

Acknowledgements

  • Thanks to @joolfe for the awesome postman-to-openapi NPM package which made conversion easy.
  • Website design taken from codebushi and theme name is Next.js Dimension
  • ← Go Back