Skip to content

srdo/swagger-converter

 
 

Repository files navigation

Swagger Converter

Join the chat at https://gitter.im/apigee-127/swagger-converter

Build Status

Converts Swagger documents from version 1.2 to version 2.0

Installation

Use npm

npm install swagger-converter --save

Usage

Swagger Converter expects two arguments.

  • resourceListing is Swagger 1.2 entry point file.
  • apiDeclarations is an array of objects that are listed in resourceListing
var convert = require('swagger-converter');

var resourceListing = require('/path/to/petstore/index.json');

var apiDeclarations = [
  require('/path/to/petstore/pet.json'),
  require('/path/to/petstore/user.json'),
  require('/path/to/petstore/store.json')
];

var swagger2Document = convert(resourceListing, apiDeclarations);

console.log(swagger2Document);
In browser

Install via Bower

bower install --save swagger-converter

Include the browser.js script in your HTML

  <script src="/path/to/swagger-converter/browser.js"></script>

Use the script

var convert = SwaggerConverter.convert;

Development

Install dependencies with npm install command and use npm test to run the test. Tests will fail if you break coding style.

Building for browser

Just run this command to make a new browser.js

npm run build

License

MIT. See LICENSE

About

Converts Swagger documents from version 1.2 to 2.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%