{"name":"swagger2openapi","version":"7.0.0","description":"Convert Swagger 2.0 definitions to OpenApi 3.0 and validate","main":"index.js","bin":{"swagger2openapi":"swagger2openapi.js","oas-validate":"oas-validate.js","boast":"boast.js"},"funding":"https://github.com/Mermade/oas-kit?sponsor=1","scripts":{"test":"mocha"},"browserify":{"transform":[["babelify",{"presets":["es2015"]}]]},"repository":{"url":"git+https://github.com/Mermade/oas-kit.git","type":"git"},"bugs":{"url":"https://github.com/mermade/oas-kit/issues"},"author":{"name":"Mike Ralphson","email":"mike.ralphson@gmail.com"},"license":"BSD-3-Clause","dependencies":{"call-me-maybe":"^1.0.1","node-fetch-h2":"^2.3.0","node-readfiles":"^0.2.0","oas-kit-common":"^1.0.8","oas-resolver":"^2.4.4","oas-schema-walker":"^1.1.5","oas-validator":"^5.0.0","reftools":"^1.1.6","yaml":"^1.10.0","yargs":"^15.3.1"},"keywords":["swagger","openapi","openapi2","openapi3","converter","conversion","validator","validation","resolver","lint","linter"],"gitHead":"d4c6b903ab3ef4a94ac3fd8a2b92eaf76b9b7fb6","homepage":"https://github.com/Mermade/oas-kit#readme","_id":"swagger2openapi@7.0.0","_nodeVersion":"12.13.0","_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (linux)","dist":{"integrity":"sha512-1sG0pl5mRRq5mld+m5Ja5R67pJAR383ExXP3h9Qu/elpadgU0vgAQhr+DvqlV6l63YF7fRCtHvrCVsHn5huQQw==","shasum":"c1eb73348d8b6c7d9f09ebe69d7d7c5819783018","tarball":"http://registry-npm.ywwl.com/swagger2openapi/download/swagger2openapi-7.0.0.tgz","fileCount":9,"unpackedSize":103604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfT0+XCRA9TVsSAnZWagAAYRMP/ifhZbe0Z/bodwhKXgwN\nj+En31i63uBxPRGf8CRAYem6YLZO3oDxFKShHilodRIE4vmcqvPiTnay05SJ\n7J3hGBa62Gt2C4BF8fRx5gsGBYD6fWVZaAPH99brQEPF8YZdUvcT49tqTZlP\nRRFxkgJjA4996nUSFYcJU+zIixNHB7xb6Ze1yERwMmi7vNYStYyEa3EI/aVe\nm65sh7lES5ubXGSI0Xgg42A1BpysxDV2OVhkVOsQNdH7bZ2yHB62V8UYVXio\nLdr3gK9ACkdREW/L9jiWVjjmQ0cERzU2FhXJuDjEWI6I2oOwLQwc6ylEB/97\nOQxRqGoZRvJQb+aoQDezwhM7qVqeHN7pxGmyvV5zuyR1sKzDvDhyFJvzNgOx\nP7UL+tUnAgEA/q+vcV0VNfbf3zFnA66UmaopEEyv3owYZQ+zVRfQBqgG5vcp\n+JINpKDIrHdPNuR3y2ggKezfTCzIJ2U6yUWko7ojrDcJID5jp1DonLyPHpLS\nJVBz6+9vjB1hf8kIOBNlFWrNLGTceA5VwVJqcOKocAUL/qtSyc1ltg0DfRmO\nE6j0pOxQnvpI0NPVUBUHzomtSFL0AIPn8mRnr150QF1tzjuWxM6NIOXIIq6W\nj463sMPEnFik32nnn8ABk/JvvrkXztTvwf7kWnN6saWqx2LjspTYCx4y5A21\ngWM2\r\n=FHYS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5YKa7WM/B/whwX1KNInTjsXJRhsPovJF+rK8ap7ZcEQIgHjRZyfI4E2QHAf3UM2mfIt+wnryqNhKKMmOLV+3UOfk="}],"size":23037,"noattachment":false,"key":"/swagger2openapi/-/swagger2openapi-7.0.0.tgz"},"maintainers":[{"name":"mermade","email":"mike.ralphson@gmail.com"}],"_npmUser":{"name":"mermade","email":"mike.ralphson@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swagger2openapi_7.0.0_1599033238678_0.09737590778135452"},"_hasShrinkwrap":false,"readme":"# swagger2openapi\n\n![logo](https://github.com/Mermade/oas-kit/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/oas-kit/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%20Docs-74426-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/oas-kit.svg)](https://greenkeeper.io/)\n\nConvert Swagger 2.0 definitions into OpenApi 3.0.x\n\nThe online version of the converter/validator runs on a [Linode](https://www.linode.com/?r=5734be467cc501b23267cf66d451bc339042ddfa) VPS. If you are considering a hosted server, please sign up through this link so we both receive free credit.\n\nCurrently tracking [v3.0.x](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md)\n\n## Installation:\nThis is a node.js module, which you can run on the command line. First ensure you have npm installed (tested on version 6.1+), and then install as follows:\n```bash\nnpm install -g swagger2openapi\n```\nOr, add it to your node.js projects as shown below in option B.\n\n## Usage:\n### A. Command line:\n\n```text\nswagger2openapi [options] [filename|url]\nOptions:\n  --refSiblings        mode to handle $ref's with sibling properties\n                                        [choices: \"remove\", \"preserve\", \"allOf\"]\n  --resolveInternal    resolve internal references also                [boolean]\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  -f, --fatal          make resolution errors fatal                    [boolean]\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  -t, --targetVersion  override default target version of 3.0.0         [string]\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\n                       extensions                                      [boolean]\n  -y, --yaml           write YAML, default JSON (overridden by --outfile\n                       filepath extension)                             [boolean]\n  -b, --rbname         Extension to use to preserve body parameter names in\n                       converted operations (\"\" == disabled)\n                                                          [string] [default: \"\"]\n```\n\n### B. Node.js API:\n\n```javascript\nconst converter = require('swagger2openapi');\nlet 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\nNote that the `options` object passed in is modified/extended by the `convert*` functions.\n\nSee the [boast command-line tool](/packages/swagger2openapi/boast.js) for a fuller CLI tool for converting, validating and linting.\n\nSee here for complete [documentation](/docs/options.md) of the `options` object.\n\n### C. Browser:\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\n`oas-validate` can be used as a 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 validator can have a linting mode enabled with the `--lint` option. Rules are defined [here](/packages/oas-linter/rules.yaml). Contributions of rules and rule actions for the linter are very much appreciated.\n\n```text\noas-validate.js [options] {path-to-docs}...\n\nOptions:\n  --lint            lint the definition                                [boolean]\n  --validateSchema  Run schema validation step: first, last* or never   [string]\n  --warnOnly        Do not throw on non-patchable errors               [boolean]\n  -h, --help        Show help                                          [boolean]\n  --version         Show version number                                [boolean]\n  -e, --encoding    encoding for input/output files   [string] [default: \"utf8\"]\n  -f, --fail        path to docs expected to fail                       [string]\n  -j, --jsonschema  path to alternative JSON schema                     [string]\n  -l, --laxurls     lax checking of empty urls                         [boolean]\n  -m, --mediatype   check media-types against RFC pattern              [boolean]\n  -n, --nopatch     do not patch minor errors in the source definition [boolean]\n  -o, --output      output conversion result  [string] [default: \"openapi.yaml\"]\n  -q, --quiet       do not show test passes on console, for CI         [boolean]\n  -r, --resolve     resolve external references                        [boolean]\n  -s, --stop        stop on first error                                [boolean]\n  -v, --verbose     increase verbosity                                   [count]\n  -w, --whatwg      enable WHATWG URL parsing                          [boolean]\n  -y, --yaml        skip YAML-safe test                                [boolean]\n```\n\n### Reference preservation\n\n`swagger2openapi` by default 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. To enable internal `$ref` resolution across the whole document, use the `--resolveInternal` option, which also disables creation of `$ref`s for shared `requestBodies`.\n\n### Schema transformations\n\n`swagger2openapi` 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\n`swagger2openapi` 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 oas-validate [-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 LTS Node.js versions 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 74,426 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](https://github.com/domharrington)) live in the `/test` directory and can be run with `npx mocha`. Each sub-directory of `s2o-test` 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. In the `resolver` sub-directory, each directory should contain an `input.yaml`, an `output.yaml` and an optional `options.yaml` file.\n\n### Version history\n\n* [Change-Log](https://github.com/Mermade/oas-kit/blob/master/CHANGELOG.md#change-log)\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/master/schemas/v3.0/schema.yaml) which is licensed under the [Apache-2](http://www.apache.org/licenses/LICENSE-2.0) license.\n","publish_time":1599033238839,"_cnpm_publish_time":1599033238839,"dist-tags":{"beta":"2.12.0-5","latest":"7.0.8"}}