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
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-converterNodeJS
npm install --save api-spec-converterBrowser
bower install --save api-spec-converterUsage
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_spece.g.
api-spec-converter https://api.gettyimages.com/swagger/api-docs --from=swagger_1 --to=swagger_2 > swagger.jsonNodeJS
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
- Swagger 1.x (swagger_1)
- Swagger 2.0 (swagger_2)
- I/O Docs (io_docs)
- API Blueprint (api_blueprint)
- Google API Discovery (google)
- RAML (raml)
- WADL (wadl)
Conversion Table
| from: | swagger_1 | swagger_2 | io_docs | api_blueprint | 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.