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
Installation
Command Line
npm install -g api-spec-converterNodeJS
npm install --save api-spec-converterUsage
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());
})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) Not yet implemented
- WADL (wadl) Not yet implemented
Conversion Table
| from: | swagger_1 | swagger_2 | io_docs | api_blueprint | raml | wadl | |
|---|---|---|---|---|---|---|---|
| to swagger_1 | n/a | ||||||
| to swagger_2 | X | n/a | X | X | X | ||
| 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.