https://github.com/liborm85/swagger-ui-offline-packager
Generates a self-contained HTML file from an OpenAPI definition, rendering it in Swagger UI for offline API documentation.
https://github.com/liborm85/swagger-ui-offline-packager
openapi rest rest-api swagger swagger-js swagger-ui
Last synced: about 2 months ago
JSON representation
Generates a self-contained HTML file from an OpenAPI definition, rendering it in Swagger UI for offline API documentation.
- Host: GitHub
- URL: https://github.com/liborm85/swagger-ui-offline-packager
- Owner: liborm85
- License: mit
- Created: 2025-01-24T16:11:29.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-27T09:45:45.000Z (10 months ago)
- Last Synced: 2025-08-09T16:54:20.486Z (6 months ago)
- Topics: openapi, rest, rest-api, swagger, swagger-js, swagger-ui
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Swagger UI Offline Packager [](https://www.npmjs.com/package/swagger-ui-offline-packager)
A tool that generates a single, self-contained HTML file from an OpenAPI definition (YAML or JSON), rendering it in Swagger UI. This allows you to view API documentation offline, without needing an internet connection or a separate web server.
## Features
- Converts OpenAPI (YAML or JSON) into a standalone Swagger UI HTML file
- The generated file works completely offline
- Supports loading the API definition from multiple files
- Supports `$ref` references in OpenAPI 3.1 specifications
- Easy to use, no external dependencies required
Perfect for sharing API documentation in a simple, portable format! 🚀
## Installation
You can install Swagger UI Offline Packager globally or locally using npm.
**Global Installation**
To install the package globally, run:
```sh
npm install -g swagger-ui-offline-packager
```
This allows you to use the `swagger-ui-offline-packager` command anywhere in your terminal. You can also use the shorter alias `sop`.
**Local Installation**
To install the package locally in your project, run:
```sh
npm install swagger-ui-offline-packager
```
You can then use it within your project scripts or via `npx`:
```sh
npx swagger-ui-offline-packager
```
or with the alias:
```sh
npx sop
```
## Usage
To generate a standalone Swagger UI HTML file, run the command with the required input file:
```
sop [output-html-file]
```
**Parameters:**
- swagger-file *(required)* – Path to the Swagger (OpenAPI) file in YAML or JSON format.
- output-html-file *(optional)* – Path to the output HTML file. If not provided, the output file will be named based on the input file.
For more information, use:
```sh
sop --help
```
## Examples:
Generate an HTML file with the default output name (generates api.html in the same directory):
```sh
sop api.yaml
```
Specify a custom output file:
```sh
sop api.yaml my-api-docs.html
```
Using npx (if installed locally):
```sh
npx sop api.json docs.html
```
## License
MIT