Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 796
StuBob Avatar asked Jul 08 '15 17:07

StuBob


3 Answers

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.

like image 126
MikeRalphson Avatar answered Oct 16 '22 04:10

MikeRalphson


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.

like image 17
StuBob Avatar answered Oct 16 '22 05:10

StuBob


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);
    });
});
like image 14
plotnik Avatar answered Oct 16 '22 06:10

plotnik