{"id":24367170,"url":"https://github.com/vajahath/open-swagger-ui","last_synced_at":"2025-07-09T13:08:27.874Z","repository":{"id":42942696,"uuid":"234310696","full_name":"vajahath/open-swagger-ui","owner":"vajahath","description":"A handy CLI / API to open swagger doc in swagger ui.","archived":false,"fork":false,"pushed_at":"2023-02-03T05:13:07.000Z","size":1471,"stargazers_count":16,"open_issues_count":7,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T05:57:11.798Z","etag":null,"topics":["cli","javascript","npm","swagger","swagger-cli","swagger-ui","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/open-swagger-ui","language":"TypeScript","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/vajahath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-16T12:01:45.000Z","updated_at":"2025-03-20T06:15:46.000Z","dependencies_parsed_at":"2023-02-18T03:45:56.140Z","dependency_job_id":null,"html_url":"https://github.com/vajahath/open-swagger-ui","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vajahath/open-swagger-ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vajahath%2Fopen-swagger-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vajahath%2Fopen-swagger-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vajahath%2Fopen-swagger-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vajahath%2Fopen-swagger-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vajahath","download_url":"https://codeload.github.com/vajahath/open-swagger-ui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vajahath%2Fopen-swagger-ui/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264465847,"owners_count":23612580,"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":["cli","javascript","npm","swagger","swagger-cli","swagger-ui","typescript"],"created_at":"2025-01-19T01:42:07.009Z","updated_at":"2025-07-09T13:08:27.532Z","avatar_url":"https://github.com/vajahath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# open-swagger-ui\n\nAn easy CLI to open `swagger.json` or `.yaml` files in [Swagger UI](https://swagger.io/tools/swagger-ui/).\n\n```bash\n$ open-swagger-ui ./swagger.json --open # done !\n```\n\n![](https://github.com/vajahath/open-swagger-ui/workflows/Build/badge.svg) [![](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)\n\n## Install\n\nRequires Node `\u003e=10`.\n\nFrom npm,\n\n```sh\nnpm i -g open-swagger-ui\n```\n\nFrom [Github Package Registry](https://github.com/vajahath/open-swagger-ui/packages). ([Guide](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages)).\n\nType definitions are bundled with this package.\n\n## CLI Usage\n\n```bash\n$ open-swagger-ui ./swagger.json\n# =\u003e starts the server.\n\n$ open-swagger-ui ./swagger.json --open # or -O for short\n# =\u003e starts server, opens it in browser.\n\n$ open-swagger-ui \u003cabsolute-path-to-swagger.json\u003e --port 8899\n# =\u003e you can put absolute/relative path for swagger.json\n# =\u003e if the requested port is not available, a random port is chosen.\n\n# Oh yes! You can put urls too..\n$ open-swagger-ui https://petstore.swagger.io/v2/swagger.json\n```\n\n### `--help` for help\n\n```bash\n$ open-swagger-ui --help\nUsage: open-swagger-ui [options] \u003cswagger-file\u003e\n\nAn easy CLI tool to open swagger.json or .yaml files in Swagger UI.\n\nOptions:\n  -V, --version      output the version number\n  -O, --open         Open stuff in browser\n  -P, --port \u003cport\u003e  Preferred port. If not available, a random port is selected\n  -h, --help         output usage information\n```\n\n## APIs\n\nYou can use this as a module too, just in case you want.\n\n```ts\nconst { startServerWithSwaggerFile } = require('open-swagger-ui');\n// or\nimport { startServerWithSwaggerFile } from 'open-swagger-ui';\n\nstartServerWithSwaggerFile('./path/to/swagger.json', port)\n  .then(({ app, port, swagFilePath, server }) =\u003e {\n    console.log(`app started on port ${port}`);\n    // app is the express server underneath\n    // you may freely add routes to it like\n    // app.use(stuff);\n  })\n  .catch(err =\u003e console.error('something went wrong', err));\n```\n\nThe `startServerWithSwaggerFile` function returns express `app`, the [HTTP `server`](https://nodejs.org/dist/latest-v13.x/docs/api/http.html#http_class_http_server) instance, `port` in which the file is open and the reference `swagFilePath`.\n\n## Licence\n\nMIT \u0026copy; [Vajahath Ahmed](https://twitter.com/vajahath7)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvajahath%2Fopen-swagger-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvajahath%2Fopen-swagger-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvajahath%2Fopen-swagger-ui/lists"}