{"bin":{"swagger2openapi":"./swagger2openapi.js"},"bugs":{"url":"https://github.com/Mermade/swagger2openapi/issues"},"dist":{"shasum":"1622f1e9111d1bf88bc6f766a299506e9c357478","tarball":"https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-2.12.0-5.tgz","fileCount":31,"integrity":"sha512-lwPhCAqq6w31ODL/iizU9zjdurWr2NS1pmTkgNw7dIxl5B3RKi6U0udzOyur7+cdx/z1AXb7/L7KgIpixRa6Mw==","signatures":[{"sig":"MEUCIHUjpELlyIAWC/9H41eylH5Eo92UzSX5ek2F0EQL0iQvAiEA8Xy3sQX1DQdSTZbq8+T3CVHH1G1NXePUYwc2ShbfA5A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":306115},"main":"index.js","name":"swagger2openapi","author":{"name":"Mike Ralphson","email":"mike.ralphson@gmail.com"},"readme":"# swagger2openapi\n\n![logo](https://github.com/Mermade/swagger2openapi/blob/master/docs/logo.png?raw=true)\n\n[![OpenAPI Validation](https://mermade.org.uk/openapi-converter/api/v1/badge?url=https://mermade.org.uk/openapi-converter/examples/openapi.json)](https://mermade.org.uk/openapi-converter/api/v1/validate?url=https://mermade.org.uk/openapi-converter/examples/openapi.json)\n![Build](https://img.shields.io/travis/Mermade/swagger2openapi/master.svg)\n[![Tested on APIs.guru](https://api.apis.guru/badges/tested_on.svg)](https://APIs.guru)\n[![Tested on Mermade OpenAPIs](https://img.shields.io/badge/Additional%20Specs-34882-brightgreen.svg)](https://github.com/mermade/openapi-definitions)\n[![Coverage Status](https://coveralls.io/repos/github/Mermade/swagger2openapi/badge.svg?branch=master)](https://coveralls.io/github/Mermade/swagger2openapi?branch=master)\n[![Known Vulnerabilities](https://snyk.io/test/npm/swagger2openapi/badge.svg)](https://snyk.io/test/npm/swagger2openapi)\n[![Greenkeeper badge](https://badges.greenkeeper.io/Mermade/swagger2openapi.svg)](https://greenkeeper.io/)\n\nConvert Swagger 2.0 definitions into OpenApi 3.0.x\n\nCurrently tracking [v3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md)\n\n**If you are using Node.js 4 - please use the --harmony flag**\n\nUsage:\n\n```\nswagger2openapi [options] [filename|url]\nOptions:\n  --warnProperty    Property name to use for warning extensions\n                                             [string] [default: \"x-s2o-warning\"]\n  --version         Show version number                                [boolean]\n  -c, --components  output information to unresolve a definition       [boolean]\n  -d, --debug       enable debug mode, adds specification-extensions   [boolean]\n  -e, --encoding    encoding for input/output files   [string] [default: \"utf8\"]\n  -h, --help        Show help                                          [boolean]\n  -i, --indent      JSON indent to use, defaults to 4 spaces            [string]\n  -o, --outfile     the output file to write to                         [string]\n  -p, --patch       fix up small errors in the source definition       [boolean]\n  -r, --resolve     resolve external references                        [boolean]\n  -u, --url         url of original spec, creates x-origin entry        [string]\n  -v, --verbose     increase verbosity                                   [count]\n  -w, --warnOnly    Do not throw on non-patchable errors, add warning extensions\n                                                                       [boolean]\n  -y, --yaml        read and write YAML, default JSON                  [boolean]\n```\n\nor use the APIs:\n\n```javascript\nvar converter = require('swagger2openapi');\nvar options = {};\n//options.patch = true; // fix up small errors in the source definition\n//options.warnOnly = true; // Do not throw on non-patchable errors\nconverter.convertObj(swagger, options, function(err, options){\n  // options.openapi contains the converted definition\n});\n// also available are asynchronous convertFile, convertUrl, convertStr and convertStream functions\n// if you omit the callback parameter, you will instead receive a Promise\n```\n\n```javascript\nvar validator = require('swagger2openapi/validate.js');\nvar options = {};\nvalidator.validate(openapi, options, function(err, options){\n  // options.valid contains the result of the validation\n  // options.context now contains a stack (array) of JSON-Pointer strings\n});\n// also available is a synchronous validateSync method which returns a boolean\n```\n\nSee here for complete [documentation](/docs/options.md) of the `options` object.\n\nOr use the [online version](https://mermade.org.uk/openapi-converter) which also includes its own [API](http://petstore.swagger.io/?url=https://mermade.org.uk/openapi-converter/contract/swagger.json).\n\n### Browser Support\n\nSee [initial documentation](/docs/browser.md).\n\n## Features\n\n### OpenAPI 3.0.x validation\n\nThe `testRunner` harness can also be used as a simple validator if given one or more existing OpenAPI 3.x definitions. The validator (however it is called) uses [WHATWG](https://whatwg.org/) URL parsing if available (node 7.x and above). The testRunner can have a linting mode enabled with the `--lint` option. Rules are defined [here](/linter/rules.json). Contributions of rules and rule actions for the linter are very much appreciated.\n\n### Reference preservation\n\nswagger2openapi preserves almost all `$ref` JSON references in your API definition, and does not dereference\nevery item, as with some model-based parsers. The exception is internal references within externally referenced documents.\n\n### Schema transformations\n\nSwagger2openapi will automatically 'repair' a number of problems where non-compliant Swagger 2.0 schemas have been used. It will attempt to transform JSON schemas (used incorrectly) into OpenAPI 3.0.x Schema objects.\n\n### Specification extensions\n\nswagger2openapi has support for a limited number of real-world [specification extensions](/docs/extensions.md) which have a direct bearing on the conversion. All other specification extensions are left untouched. swagger2openapi is [swaggerplusplus](https://github.com/mermade/swaggerplusplus)-compatible.\n\nIt is expected to be able to configure the process of specification-extension modification using options or a plugin mechanism in a future release.\n\n## Tests\n\nTo run a test-suite:\n\n```shell\nnode testRunner [-f {path-to-expected-failures}]... [{path-to-APIs|single-file...}]\n```\n\nThe test harness currently expects files with a `.json` or `.yaml` extension, or a single named file, and has been tested on Node.js versions 4.x, 6.x and 8.x LTS (it is not recommended to run the test suite under Node.js versions >=7.0.0 and \\<8.7.0 because of [this bug](https://github.com/nodejs/node/issues/13048)) against\n\n* [APIs.guru](https://github.com/APIs-guru/openapi-directory)\n* [Mermade OpenApi specifications collection](https://github.com/mermade/openapi_specifications)\n* [OpenAPI3-Examples (pass/fail)](https://github.com/mermade/openapi3-examples)\n* [SOM-Research collection](https://github.com/SOM-Research/hapi)\n\nAdditionally swagger2openapi has been tested on a corpus of 34,679 real-world valid Swagger 2.0 definitions from GitHub and [SwaggerHub](https://swaggerhub.com/). However, if you have a definition which causes errors in the converter or does not pass validation, please do not hesitate to [raise an issue](https://github.com/Mermade/swagger2openapi/issues).\n\n### Regression tests\n\nRegression tests (thanks @domharrington) live in the `/test` directory and can be run with `npx mocha`. Each sub-directory should contain an input `swagger.yaml` file, an expected output `openapi.yaml` file and an optional `options.yaml` file. You can put private test cases in sub-directories starting with an underscore character.\n\n## License\n\n[BSD-3-Clause](LICENSE) except the `openapi-3.0.json` schema, which is taken from the [OpenAPI-Specification](https://github.com/OAI/OpenAPI-Specification/blob/49e784d7b7800da8732103aa3ac56bc7ccde5cfb/schemas/v3.0/schema.yaml) and the alternative `gnostic-3.0.json` schema, which is originally from [Google Gnostic](https://github.com/googleapis/gnostic/blob/master/OpenAPIv3/openapi-3.0.json). Both of these are licensed under the [Apache-2](http://www.apache.org/licenses/LICENSE-2.0) license.\n","gitHead":"a63a774b82709a19cf6a7ed3a3567fb74cfecdfa","license":"BSD-3-Clause","scripts":{"test":"mocha"},"_npmUser":{"name":"mermade","email":"mike.ralphson@gmail.com"},"homepage":"https://github.com/Mermade/swagger2openapi#readme","keywords":["swagger","openapi","openapi2","openapi3","converter","conversion","validator","validation","resolver","lint","linter"],"browserify":{"transform":[["babelify",{"presets":["es2015"]}]]},"repository":{"url":"git+https://github.com/Mermade/swagger2openapi.git","type":"git"},"_npmVersion":"5.6.0","description":"Convert Swagger 2.0 definitions to OpenApi 3.0 and validate","directories":{},"maintainers":[{"name":"mermade","email":"mike.ralphson@gmail.com"}],"_nodeVersion":"8.9.4","dependencies":{"co":"^4.6.0","ajv":"^5.0.1","yargs":"^11.0.0","should":"^13.0.1","js-yaml":"^3.6.1","reftools":"0.0.20","node-fetch":"^2.0.0","call-me-maybe":"^1.0.1","node-readfiles":"^0.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"mocha":"^5.0.0","webpack":"^3.5.6","coveralls":"^3.0.0","babel-core":"^6.24.1","babel-loader":"^7.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/swagger2openapi_2.12.0-5_1518024908161_0.0015337045608951883","host":"s3://npm-registry-packages"},"_id":"swagger2openapi@2.12.0-5","version":"2.12.0-5"}