{"id":13612694,"url":"https://github.com/stoplightio/api-spec-converter","last_synced_at":"2025-04-13T12:32:29.209Z","repository":{"id":57181940,"uuid":"41714744","full_name":"stoplightio/api-spec-converter","owner":"stoplightio","description":"This package helps to convert between different API specifications (Postman, Swagger, RAML, StopLight).","archived":true,"fork":false,"pushed_at":"2018-12-04T16:45:07.000Z","size":1131,"stargazers_count":139,"open_issues_count":10,"forks_count":88,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-05T22:43:21.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoplightio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-01T03:26:30.000Z","updated_at":"2025-01-27T20:45:17.000Z","dependencies_parsed_at":"2022-09-13T02:51:06.295Z","dependency_job_id":null,"html_url":"https://github.com/stoplightio/api-spec-converter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fapi-spec-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fapi-spec-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fapi-spec-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fapi-spec-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoplightio","download_url":"https://codeload.github.com/stoplightio/api-spec-converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714689,"owners_count":21149940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:00:33.229Z","updated_at":"2025-04-13T12:32:28.584Z","avatar_url":"https://github.com/stoplightio.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# API Spec Transformer [![Build Status](https://travis-ci.org/stoplightio/api-spec-converter.svg)](https://travis-ci.org/stoplightio/api-spec-converter) [![Coverage Status](https://coveralls.io/repos/stoplightio/api-spec-converter/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/stoplightio/api-spec-converter?branch=master)\n\nThis package helps to convert between different API specifications. It currently supports OAS (Swagger 2), RAML 0.8, RAML 1.0, and Postman collections.\n\nThis package is used in production @ [https://stoplight.io](https://stoplight.io). If you are using this package in production, please let us know and we will link you.\n\n## Note\n\nA prior version of this library was available, but not published on NPM. If you are directly referencing the git URL in your package.json files, please update them to use the `api-spec-transformer` package name, instead of `https://github.com/stoplightio/api-spec-converter`. We will be re-naming the git repository to `https://github.com/stoplightio/api-spec-transformer` in the near future.\n\n## Installation\n\n### NodeJS or Browser\n\n```bash\nnpm install --save api-spec-transformer\n```\n\n\n## Usage\n\n### Convert RAML1.0 to OAS (Swagger), from a file.\n\n```js\nvar transformer = require('api-spec-transformer');\n\nvar ramlToSwagger = new transformer.Converter(transformer.Formats.RAML10, transformer.Formats.SWAGGER);\n\nramlToSwagger.loadFile('/source/raml.yaml', function(err) {\n  if (err) {\n    console.log(err.stack);\n    return;\n  }\n\n  ramlToSwagger.convert('yaml')\n    .then(function(convertedData) {\n      // convertedData is swagger YAML string\n    })\n    .catch(function(err){\n      console.log(err);\n    });\n});\n```\n\n### Convert OAS (Swagger) to RAML1.0, from a URL.\n\n```js\nvar transformer = require('api-spec-transformer');\n\n// Convert swagger to raml, from a url.\n\nvar swaggerToRaml = new transformer.Converter(transformer.Formats.SWAGGER, transformer.Formats.RAML10);\n\nswaggerToRaml.loadFile('http://petstore.swagger.io/v2/swagger.json', function(err) {\n  if (err) {\n    console.log(err.stack);\n    return;\n  }\n\n  swaggerToRaml.convert('yaml')\n    .then(function(convertedData) {\n      // convertedData is a raml YAML string\n    })\n    .catch(function(err){\n      console.log(err);\n    });\n});\n```\n\n### Convert unknown input to RAML1.0:\n\nYou can tell the converter to detect the input format automatically (by passing `AUTO` format), it will detect the right format for the input.\n\n```js\nvar transformer = require('api-spec-transformer');\n\nvar myConverter = new transformer.Converter(transformer.Formats.AUTO, transformer.Formats.RAML10);\n\nswaggerToRaml.loadFile('http://petstore.swagger.io/v2/swagger.json', function(err) {\n  // Will identify the input as swagger - the rest is the same as above.\n});\n```\n\n### Load a string:\n\n```js\nvar transformer = require('api-spec-transformer');\n\nvar swaggerToRaml = new transformer.Converter(transformer.Formats.SWAGGER, transformer.Formats.RAML10);\n\nvar mySwaggerString = '...';\n\nswaggerToRaml.loadData(mySwaggerString)\n  .then(function() {\n    // Do the converstion, as in the first two examples.\n  });\n```\n\n## Supported Conversions\n\n- OAS (Swagger 2) -\u003e RAML 0.8\n- OAS (Swagger 2) -\u003e RAML 1.0\n- RAML 1.0 -\u003e OAS (Swagger 2)\n- RAML 0.8 -\u003e OAS (Swagger 2)\n- Postman Collection 1.0 -\u003e OAS (Swagger 2) * Experimental\n- Postman Collection 1.0 -\u003e RAML 0.8 * Experimental\n- Postman Collection 1.0 -\u003e RAML 1.0 * Experimental\n\n## Development\n\nInstall dependencies:\n```bash\nnpm install\n```\n\nRun tests:\n```bash\nnpm test\n```\n\nRun eslint to check linting errors:\n```bash\ngulp lint\n```\n\n## Contributing\n\nContributions are welcome! Please check the current issues to make sure what you are trying to do has not already been discussed.\n\n1. Fork.\n2. Make changes.\n3. Write tests.\n4. Send a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fapi-spec-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoplightio%2Fapi-spec-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fapi-spec-converter/lists"}