All Projects → postmanlabs → swagger2-to-postman

postmanlabs / swagger2-to-postman

Licence: Apache-2.0 license
Converter for swagger 2.0 JSON to Postman Collection

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Swagger 2 to Postman converter

Converter for swagger 2.0 JSON to Postman Collection v1

Install dependencies

run $ npm install to install the dependencies

Run NPM test

run $ npm test to see the converter in action

Want to convert your own files?

convert.js provides a jsFace class - Swagger2Postman. Check test/converter.spec.js for basic usage.

Initialise class:

var swaggerConverter = new Swagger2Postman();

Optionally, set a logger:

swaggerConverter.setLogger(console.log);

Convert your Swagger 2.0 JSON:

var convertResult = swaggerConverter.convert(swaggerJson);

Check the result:

convertResult.status === "failed"

for unsuccessful conversions. Check convertResult.message

convertResult.status === "passed"

for successful conversions. Check convertResult.collection for the Postman collection JSON

Optional Configuration Parameters: The constructor can also take in a map of configuration options

var options = {
  includeQueryParams: false
};

var swaggerConverter = new Swagger2Postman(options);

valid options are: includeQueryParams - (default true) Include query string parameters in the request url.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].