How can I generate swagger based off of existing postman collection? [closed]

I am developing a REST API. during development I have used postman (chrome extension) to use and document my API. It is a wonderful tool and I have most of my API endpoints in it. However, as we near release I would like to document this API in swagger, how would I do that? Is there a way that I can generate swagger based off of the postman export?


Solution 1:

APIMatic API Transformer can process a Postman collection (v1 or v2) as an input format and produce Swagger 1.2 or 2.0, and now OpenAPI 3.0.0 as output.

It has its own API and a Web front-end, and also a command-line version.

Solution 2:

Someone posted this link (and deleted it?): http://restunited.com/

It accepts postman JSON and converts it to swagger. This seems to be what I was looking for.

Solution 3:

You can use https://github.com/stoplightio/api-spec-converter with code

var transformer = require('api-spec-transformer');

var postmanToSwagger = new transformer.Converter(transformer.Formats.POSTMAN, transformer.Formats.SWAGGER);

postmanToSwagger.loadFile('/path/to/your.json.postman_collection', function(err) {
  if (err) {
    console.log(err.stack);
    return;
  }

  postmanToSwagger.convert('yaml')
    .then(function(convertedData) {
      // convertedData is swagger YAML string
      console.log(convertedData);
    })
    .catch(function(err){
      console.log(err);
    });
});