JSPM

  • Created
  • Published
  • Downloads 26087
  • Score
    100M100P100Q145065F
  • License MIT

Convert between API description formats such as Swagger and RAML

Package Exports

  • api-spec-converter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (api-spec-converter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

api-spec-converter

Share on Twitter

Chat on gitter NPM version Bower version Build status

Code climate Dependency status devDependency status

Convert between API description formats such as Swagger and RAML

Currently only supports conversion to Swagger 2.0

You can also use the online version at https://lucybot.github.io/api-spec-converter

Installation

Command Line

npm install -g api-spec-converter

NodeJS

npm install --save api-spec-converter

Browser

bower install --save api-spec-converter

Usage

Options

  • from - source format (see types below)
  • to - desired format (see types below)
  • source - Filename or URL for the source

Command Line

api-spec-converter <URL|filename> --from type_1 --to type_2 > output_spec

e.g.

api-spec-converter https://api.gettyimages.com/swagger/api-docs --from=swagger_1 --to=swagger_2 > swagger.json

NodeJS

var Converter = require('api-spec-converter');
Converter.convert({
  from: 'swagger_1',
  to: 'swagger_2',
  source: 'https://api.gettyimages.com/swagger/api-docs',
}, function(err, converted) {
  console.log(converted.spec);
  FS.writeFileSync('swagger2.json', converted.stringify());
})

Browser

Note: API Blueprint is not yet supported in the browser

APISpecConverter.convert(...)

Supported Types

Conversion Table

from: swagger_1 swagger_2 io_docs api_blueprint google raml wadl
to swagger_1 n/a
to swagger_2 n/a
to io_docs n/a
to api_blueprint n/a
to google n/a
to raml n/a
to wadl n/a

Contributing

Contributions are welcome. I'll try to respond to pull requests within 24 hours.