The `api-spec-converter` package provides a utility for transforming API descriptions between various popular formats, including OpenAPI (formerly Swagger), RAML, API Blueprint, I/O Docs, Google Discovery, and WADL. As of its current stable version, 2.12.0, its core functionality is robust for conversions *to* OpenAPI 2.0 and *from* OpenAPI 2.0 to OpenAPI 3.x. This specialized focus means it does not offer full bidirectional conversion support for all listed formats. The library offers both a command-line interface (CLI) for quick conversions and a programmatic API for Node.js and browser environments, supporting both traditional callback and modern Promise-based asynchronous patterns. While a specific release cadence isn't explicitly stated, the version numbering indicates ongoing development and maintenance, making it a reliable choice for its specific conversion strengths within the API ecosystem.
npm install api-spec-converterVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to programmatically convert an OpenAPI 1.x (Swagger 1.x) specification from a URL to OpenAPI 2.0, fill in any missing required fields with dummy data, validate the resulting specification, and then write it to a local JSON file.
Always verify the 'from' and 'to' formats against the officially supported conversion paths in the README before attempting conversion. If you need broader or more complex inter-format conversions, consider using other tools or manual migration.
If global installation fails, try `npm install --force -g api-spec-converter` or use `npm install api-spec-converter` for local project-level usage and run it via `npx api-spec-converter`.
Ensure your Node.js environment meets or exceeds version 6.0.0. Use a Node.js version manager like `nvm` or `fnm` to easily switch and manage Node.js versions.
For ES Modules, use `import Converter from 'api-spec-converter';`. For CommonJS, use `const Converter = require('api-spec-converter');`.In Node.js, you must `require()` or `import` the module using `const Converter = require('api-spec-converter');`. The `APISpecConverter` global is only available in browsers after including the UMD build script.Ensure the format strings match the officially supported list: `swagger_1`, `swagger_2`, `openapi_3`, `api_blueprint`, `io_docs`, `google`, `raml`, `wadl`. Also, verify the conversion path (e.g., from `raml` to `openapi_3`) is supported.
No dependency data recorded yet.