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.0.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 your Swagger 1.2 documents to follow Swagger 1.2 routing semantics. For example, if your root Swagger file like following code, you will need to have files that are located relatively to your root Swagger document.

index.json

{
  "apiVersion": "1.0.0",
  "swaggerVersion": "1.2",
  "apis": [
    {
      "path": "/pet",
      "description": "Operations about pets"
    },
    {
      "path": "/user",
      "description": "Operations about user"
    },
    {
      "path": "/store",
      "description": "Operations about store"
    }
  ]
}

For Swagger Converter to work with this document, it needs to find pet, user and store files in the same location of index.json. It basically uses path values as a relative path in file system to find those files. So for this example, your file structure should look like this:

petstore/
├── index.json
├── pet
├── store
└── user

Now to convert this Swagger 1.2 document we can start from index.json as entry point:

var convert = require('swagger-converter');
var pathToIndexJson = '/path/to/petstore/index.json';

convert(pathToIndexJson, function(error, swagger2Document) {
  console.log(JSON.stringify(swagger2Document, null, 2));
});

Development

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

License

MIT. See LICENSE

Keywords

FAQs

Package last updated on 11 Dec 2014

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