Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-converter

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-converter

Swagger Converter

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42K
decreased by-63.99%
Maintainers
1
Weekly downloads
 
Created
Source

Swagger Converter

Build Status

Swagger Converter 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 fs = require('fs');
var resourceListing = JSON.parse(fs.readFileSync('/path/to/petstore/index.json').toString());
var apiDeclarations = [
  JSON.parse(fs.readFileSync('/path/to/petstore/pet.json').toString()),
  JSON.parse(fs.readFileSync('/path/to/petstore/user.json').toString()),
  JSON.parse(fs.readFileSync('/path/to/petstore/store.json').toString())
];

var swagger2Document = convert(resourceListing, apiDeclarations);

console.log(JSON.stringify(swagger2Document, null, 2));
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

Keywords

FAQs

Package last updated on 28 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc