{"id":21196749,"url":"https://github.com/egomobile/swagger-ui-cli","last_synced_at":"2025-07-10T05:30:55.118Z","repository":{"id":49725499,"uuid":"372474657","full_name":"egomobile/swagger-ui-cli","owner":"egomobile","description":"A standalone CLI application, serving Swagger UIs via a HTTP server.","archived":true,"fork":false,"pushed_at":"2023-10-31T13:37:29.000Z","size":701,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T02:39:36.903Z","etag":null,"topics":["cli","json","nodejs","openapi","rest-api","swagger","toml","typescript","yaml"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/swagger-ui-cli","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/egomobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-31T10:56:17.000Z","updated_at":"2025-03-20T06:14:48.000Z","dependencies_parsed_at":"2024-11-20T19:51:33.229Z","dependency_job_id":null,"html_url":"https://github.com/egomobile/swagger-ui-cli","commit_stats":{"total_commits":36,"total_committers":5,"mean_commits":7.2,"dds":0.6388888888888888,"last_synced_commit":"5aab369131ea0b5f48884c673fa84e5a6f2a5a69"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/egomobile/swagger-ui-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fswagger-ui-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fswagger-ui-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fswagger-ui-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fswagger-ui-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egomobile","download_url":"https://codeload.github.com/egomobile/swagger-ui-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fswagger-ui-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264535990,"owners_count":23624404,"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","json","nodejs","openapi","rest-api","swagger","toml","typescript","yaml"],"created_at":"2024-11-20T19:41:16.870Z","updated_at":"2025-07-10T05:30:54.874Z","avatar_url":"https://github.com/egomobile.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/swagger-ui-cli.svg)](https://www.npmjs.com/package/swagger-ui-cli)\n\n# swagger-ui-cli\n\nA standalone CLI application, serving [Swagger UIs](https://swagger.io/tools/swagger-ui/) via a HTTP server.\n\n## Install\n\nYou can install it globally:\n\n```bash\nnpm install -g swagger-ui-cli\n```\n\nOr for your project, from where your `package.json` file is stored:\n\n```bash\nnpm install --save-dev swagger-ui-cli\n```\n\n## Usage\n\n```\n$ swagger-ui --help\n\n  A standalone CLI application, serving Swagger UIs via a HTTP server.\n\n  Usage\n    $ swagger-ui [options] \u003cfile\u003e\n\n  Options\n    --allow-scripts    Allow the execution of scripts. Default: (false)\n    --do-not-open      Do not open local URL after server has been started. Default: (false)\n    --no-json          Do not provide JSON data as download. Default: (false)\n    --no-toml          Do not provide TOML data as download. Default: (false)\n    --no-yaml          Do not provide YAML data as download. Default: (false)\n    --port, -p         The custom TCP port. Default: 8080\n\n  \u003cfile\u003e The source document as local file path or URL. Supports JSON, YAML and TOML.\n\n  Examples\n    Starts a new server instance on port 8080 for a local file\n    $ swagger-ui swaggerFile.yaml\n\n    Run a Node.js script (also from a remote host), which builds the document\n    $ swagger-ui buildDoc.js --allow-scripts\n\n    Using port 8181 and load document from HTTP server without providing TOML as download\n    $ swagger-ui https://raw.githubusercontent.com/apache/superset/1.4.0rc2/docs/src/resources/openapi.json --no-toml --port=8181\n\n    Do not open browser, after server has been started and use \"foo\" as username and \"bar\" as password\n    $ swagger-ui https://example.com/my-api.toml --do-not-open --username=foo --password=bar\n```\n\n### Scripts\n\nIf you have a complex logic to build an [OpenAPI](https://www.openapis.org/) document, maybe it is separated into multiply sources and parts, you can execute JavaScript code, which runs in the same Node.js environment as the application.\n\nIn that case, you have to start the application with `--allow-scripts` flag.\n\nExample:\n\n```javascript\n// use any Node.js you want\nconst fs = require(\"fs\");\n// you are also able to access 3rd party modules\n// if a 'node_modules' folder is available\nconst axios = require(\"axios\");\n// make use of local Node modules\n// which exports functions that loads\n// parts of the document, e.g.\nconst myModule = require(\"/path/to/my/module.js\");\n\nconst info = await fs.promises.readFile(\n  \"/path/to/apiDocumentInfo.json\",\n  \"utf8\"\n);\n\n// maybe load data from remote sources\nconst paths = (await axios.get(\"https://strapi.example.com/paths\")).data;\nconst components = await myModule.loadComponents();\n\n// put all parts together ...\nconst doc = {\n  openapi: \"3.0.0\",\n\n  info,\n\n  servers: [\n    {\n      url: \"http://petstore.swagger.io/api\",\n    },\n  ],\n\n  paths,\n  components,\n};\n\n// ... and return the document\nreturn doc;\n```\n\n## Download\n\nYou can download documents via browser or HTTP client directly. Examples:\n\n- http://localhost:8080/json ([JSON](https://en.wikipedia.org/wiki/JSON))\n- http://localhost:8080/toml ([TOML](https://en.wikipedia.org/wiki/TOML))\n- http://localhost:8080/yaml ([YAML](https://en.wikipedia.org/wiki/YAML))\n\n## Contributors\n\n- [malagege](https://github.com/malagege)\n- [Geno Roupsky](https://github.com/groupsky)\n\n## License\n\n[GPL 3.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegomobile%2Fswagger-ui-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegomobile%2Fswagger-ui-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegomobile%2Fswagger-ui-cli/lists"}