Converts Swagger documents from version
1.2
to version2.0
Use npm
npm install swagger-converter --save
Swagger Converter expects two arguments.
resourceListing
is Swagger 1.2 entry point file.apiDeclarations
is an array of objects that are listed inresourceListing
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);
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;
Install dependencies with npm install
command and use npm test
to run the test. Tests will fail if you break coding style.
Just run this command to make a new browser.js
npm run build
MIT. See LICENSE