rapidoc 9.3.8 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -61
- package/dist/rapidoc-min.js +279 -3914
- package/package.json +23 -46
- package/.babelrc.json +0 -42
- package/.eslintrc +0 -53
- package/.github/FUNDING.yml +0 -13
- package/.github/workflow/words.yaml +0 -22
- package/CONTRIBUTING.md +0 -35
- package/dist/index.html +0 -1010
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js.LICENSE.txt +0 -64
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +0 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +0 -21603
- package/dist/report.html +0 -39
- package/index-hashroute.html +0 -65
- package/index.html +0 -1045
- package/index_bak.html +0 -251
- package/jsconfig.json +0 -11
- package/logo.png +0 -0
- package/performance.html +0 -31
- package/src/components/api-request.js +0 -1793
- package/src/components/api-response.js +0 -335
- package/src/components/dialog-box.js +0 -73
- package/src/components/json-tree.js +0 -145
- package/src/components/schema-table.js +0 -367
- package/src/components/schema-tree.js +0 -381
- package/src/components/tag-input.js +0 -135
- package/src/index.js +0 -7
- package/src/json-schema-viewer.js +0 -346
- package/src/oauth-receiver.js +0 -56
- package/src/rapidoc-mini.js +0 -382
- package/src/rapidoc.js +0 -1083
- package/src/styles/border-styles.js +0 -24
- package/src/styles/custom-styles.js +0 -10
- package/src/styles/dialog-box-styles.js +0 -75
- package/src/styles/endpoint-styles.js +0 -202
- package/src/styles/flex-styles.js +0 -15
- package/src/styles/font-styles.js +0 -268
- package/src/styles/info-styles.js +0 -21
- package/src/styles/input-styles.js +0 -207
- package/src/styles/nav-styles.js +0 -198
- package/src/styles/prism-styles.js +0 -105
- package/src/styles/schema-styles.js +0 -121
- package/src/styles/tab-styles.js +0 -47
- package/src/styles/table-styles.js +0 -58
- package/src/templates/advance-search-template.js +0 -72
- package/src/templates/callback-template.js +0 -75
- package/src/templates/code-samples-template.js +0 -34
- package/src/templates/components-template.js +0 -76
- package/src/templates/endpoint-template.js +0 -251
- package/src/templates/expanded-endpoint-template.js +0 -199
- package/src/templates/focused-endpoint-template.js +0 -110
- package/src/templates/header-template.js +0 -66
- package/src/templates/json-schema-viewer-template.js +0 -185
- package/src/templates/logo-template.js +0 -18
- package/src/templates/main-body-template.js +0 -110
- package/src/templates/navbar-template.js +0 -272
- package/src/templates/overview-template.js +0 -79
- package/src/templates/security-scheme-template.js +0 -612
- package/src/templates/server-template.js +0 -115
- package/src/utils/color-utils.js +0 -59
- package/src/utils/common-utils.js +0 -168
- package/src/utils/schema-utils.js +0 -1086
- package/src/utils/spec-parser.js +0 -462
- package/src/utils/theme.js +0 -288
- package/webpack.config.js +0 -142
package/README.md
CHANGED
|
@@ -1,77 +1,209 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="RapiDoc logo" src="https://github.com/rapi-doc/RapiDoc/blob/master/logo.png" width="80px" />
|
|
3
|
+
</p>
|
|
3
4
|
|
|
4
5
|
<p align="center">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<img src="https://img.shields.io/github/size/rapi-doc/rapidoc/dist/rapidoc-min.js.gz.svg?colorB=blue&label=zip&style=flat-square">
|
|
8
|
-
<a href="https://www.webcomponents.org/element/rapidoc" alt="published on webcomponents.org">
|
|
9
|
-
<img src="https://img.shields.io/badge/webcomponents.org-rapidoc-blue.svg?style=social"/>
|
|
10
|
-
</a>
|
|
6
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square"/>
|
|
7
|
+
|
|
11
8
|
</p>
|
|
12
9
|
|
|
13
10
|
# RapiDoc
|
|
14
|
-
Custom Element for Open-API spec viewing
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
**Custom Element for OpenAPI / Swagger Spec Viewing**
|
|
13
|
+
|
|
14
|
+
RapiDoc is a fast, responsive, and customizable Web Component that renders beautiful, interactive API documentation from OpenAPI (Swagger) specifications.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- Branding
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
19
|
+
|
|
20
|
+
- **OpenAPI Support:** Full support for OpenAPI 3.0.x, 3.1.x, and Swagger 2.0.
|
|
21
|
+
- **Framework Agnostic:** Works with plain HTML, React, Vue, Angular, Svelte, or Lit.
|
|
22
|
+
- **Built-in API Console:** Call and test APIs directly from the documentation.
|
|
23
|
+
- **Usability First:**
|
|
24
|
+
- Models and examples expanded by default — no endless clicking to reveal schemas.
|
|
25
|
+
- Pre-populated sample data in request fields.
|
|
26
|
+
- Side-by-side request and response view for quick comparison.
|
|
27
|
+
- **Branding & Theming:**
|
|
28
|
+
- Dark and Light themes out of the box.
|
|
29
|
+
- Easily customizable brand colors, typography, logos, and header styling.
|
|
30
|
+
- **Customizable Layouts:**
|
|
31
|
+
- Three distinct rendering styles: `read`, `view`, and `focused`.
|
|
32
|
+
- Inject custom content using web component slots (`fixed-header`, `overview`, `servers`, `auth`).
|
|
33
|
+
- **Fast & Lightweight:** Built using [Lit](https://lit.dev/) with zero unnecessary overhead.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Usage
|
|
38
|
+
|
|
39
|
+
Include the script in your HTML page and use the `<rapi-doc>` custom element:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<!DOCTYPE html>
|
|
43
|
+
<html>
|
|
44
|
+
<head>
|
|
45
|
+
<meta charset="utf-8">
|
|
46
|
+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
<rapi-doc
|
|
50
|
+
spec-url="https://petstore.swagger.io/v2/swagger.json"
|
|
51
|
+
theme="dark"
|
|
52
|
+
render-style="read"
|
|
53
|
+
></rapi-doc>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Repository Architecture
|
|
61
|
+
|
|
62
|
+
This repository is structured as a **Monorepo** using workspaces, compatible with **Node/npm**, **pnpm**, and **Bun**:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
astro-rapidoc/
|
|
66
|
+
├── packages/
|
|
67
|
+
│ ├── rapidoc/ # Core Web Component library (published as "rapidoc")
|
|
68
|
+
│ │ ├── src/ # Web component source code (Lit + modern ESM)
|
|
69
|
+
│ │ ├── dist/ # Production bundle (rapidoc-min.js)
|
|
70
|
+
│ │ ├── package.json # Library package config
|
|
71
|
+
│ │ └── vite.config.mjs # Dedicated library build config
|
|
72
|
+
│ │
|
|
73
|
+
│ ├── rapidoc-cli/ # Command-line utility (lint, preview, bundle)
|
|
74
|
+
│ │ ├── src/ # CLI source code
|
|
75
|
+
│ │ └── package.json
|
|
76
|
+
│ │
|
|
77
|
+
│ └── rapidoc-portal/ # PocketBase developer portal to host & secure specs
|
|
78
|
+
│ └── package.json
|
|
79
|
+
│
|
|
80
|
+
├── docs/ # Astro documentation & showcase site (GitHub Pages)
|
|
81
|
+
│ ├── src/ # Astro pages, components, and layouts
|
|
82
|
+
│ │ ├── pages/examples/ # Public showcase pages (code-highlight, petstore, etc.)
|
|
83
|
+
│ │ └── pages/tests/ # Internal test & edge-case pages
|
|
84
|
+
│ ├── public/
|
|
85
|
+
│ │ ├── specs/ # PUBLIC showcase specs (used by /examples)
|
|
86
|
+
│ │ └── specs-test/ # INTERNAL test specs (edge cases & parser fixtures)
|
|
87
|
+
│ │ └── parser/ # Malformed & validation test specs
|
|
88
|
+
│ ├── astro.config.mjs # Astro site configuration
|
|
89
|
+
│ └── package.json # Workspace package "docs"
|
|
90
|
+
│
|
|
91
|
+
├── tests/
|
|
92
|
+
│ └── visual/ # Automated visual regression test suite (Playwright)
|
|
93
|
+
│
|
|
94
|
+
├── package.json # Monorepo root configuration (workspaces)
|
|
95
|
+
└── README.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Development & Build Instructions
|
|
101
|
+
|
|
102
|
+
### Prerequisites
|
|
103
|
+
- **Node.js**: `>= 22.12.0` (or [Bun](https://bun.sh/))
|
|
104
|
+
- **npm** (or `bun`)
|
|
105
|
+
|
|
106
|
+
### 1. Installation
|
|
107
|
+
Clone the repository and install dependencies across all workspaces:
|
|
54
108
|
```bash
|
|
55
|
-
|
|
109
|
+
git clone https://github.com/rapi-doc/RapiDoc.git
|
|
110
|
+
cd RapiDoc
|
|
56
111
|
npm install
|
|
112
|
+
```
|
|
57
113
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
114
|
+
### 2. Development Server
|
|
115
|
+
Start the local documentation and examples server:
|
|
116
|
+
```bash
|
|
117
|
+
# Start dev server
|
|
118
|
+
npm run dev
|
|
61
119
|
|
|
62
|
-
#
|
|
63
|
-
npm run
|
|
120
|
+
# Stop background dev server
|
|
121
|
+
npm run stop
|
|
64
122
|
```
|
|
123
|
+
- Open `http://localhost:4321` in your browser.
|
|
124
|
+
- **Instant HMR:** During development, the server maps directly to `packages/rapidoc/src/index.js`. Any edit you make to RapiDoc's component source reloads immediately in your browser without requiring a rebuild!
|
|
125
|
+
|
|
126
|
+
### 3. Building
|
|
127
|
+
|
|
128
|
+
| Command | Description |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `npm run dev` | Starts the Astro development server. |
|
|
131
|
+
| `npm run stop` | Stops the running Astro development server. |
|
|
132
|
+
| `npm run build` | Builds both the `rapidoc` web component library and the `docs` site. |
|
|
133
|
+
| `npm run build:rapidoc` | Builds only the RapiDoc web component (`packages/rapidoc/dist/rapidoc-min.js`). |
|
|
134
|
+
| `npm run build:docs` | Builds only the Astro documentation site (`docs/generated-docs/`). |
|
|
135
|
+
| `npm run build:size` | Builds RapiDoc with a visual bundle analyzer report (`dist/stats.html`). |
|
|
136
|
+
| `npm run preview` | Previews the built production documentation site locally. |
|
|
137
|
+
|
|
138
|
+
### 4. Code Quality & Linting
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Run ESLint on packages/rapidoc
|
|
142
|
+
npm run lint
|
|
143
|
+
|
|
144
|
+
# Run Lit Analyzer for Web Component template validation
|
|
145
|
+
npm run analyze
|
|
146
|
+
|
|
147
|
+
# Check code formatting with Prettier
|
|
148
|
+
npm run format
|
|
149
|
+
|
|
150
|
+
# Automatically fix code formatting
|
|
151
|
+
npm run format-fix
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 5. Publishing to npm
|
|
155
|
+
|
|
156
|
+
To publish a new version of the core `rapidoc` package to npm:
|
|
157
|
+
|
|
158
|
+
1. **Bump Version:** Update `"version"` in `packages/rapidoc/package.json` (e.g. `9.3.9`).
|
|
159
|
+
2. **Build Library Bundle:**
|
|
160
|
+
```bash
|
|
161
|
+
npm run build:rapidoc
|
|
162
|
+
```
|
|
163
|
+
3. **Publish to npm Registry:**
|
|
164
|
+
```bash
|
|
165
|
+
npm run publish:rapidoc
|
|
166
|
+
```
|
|
167
|
+
*(Or navigate into `cd packages/rapidoc && npm publish`)*.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Documentation Site & GitHub Pages Deployment
|
|
172
|
+
|
|
173
|
+
The documentation site is built with modern **Astro** using clean, extensionless URLs (`/api`, `/examples`, `/list`, `/quickstart`).
|
|
174
|
+
|
|
175
|
+
### Deployment via GitHub Actions
|
|
176
|
+
When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/mrin/work/astro-rapidoc/.github/workflows/deploy-docs.yml) GitHub Action automatically:
|
|
177
|
+
1. Compiles the `rapidoc` library bundle.
|
|
178
|
+
2. Builds the documentation site (`npm run build:docs`).
|
|
179
|
+
3. Deploys the static output (`docs/generated-docs/`) directly to **GitHub Pages**.
|
|
180
|
+
|
|
181
|
+
> **Note on GitHub Pages Configuration:**
|
|
182
|
+
> In repository settings under **Settings → Pages**, set **Source** to **GitHub Actions**. This keeps the repository clean by eliminating the need to commit compiled static HTML files into git branches.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Specs Organization
|
|
187
|
+
|
|
188
|
+
OpenAPI specs are organized inside `docs/public/` based on their visibility and purpose:
|
|
189
|
+
|
|
190
|
+
* **`docs/public/specs/`**: Public showcase specs referenced in [example-list.yaml](file:///Users/mrin/work/astro-rapidoc/docs/src/data/example-list.yaml) and displayed on `rapidocweb.com` (e.g., `petstore.yaml`, `code-highlight.yaml`, `auth.yaml`).
|
|
191
|
+
* **`docs/public/specs-test/`**: Internal edge-case and boundary specs used for UI verification and regression tests (e.g., `circular-refs.yaml`, `xxx-of-combinations.yaml`).
|
|
192
|
+
* **`docs/public/specs-test/parser/`**: Malformed or invalid specs used to test CLI validation and error reporting (e.g., `invalid-syntax.yaml`, `missing-info.yaml`, `broken-ref.yaml`).
|
|
193
|
+
|
|
194
|
+
---
|
|
65
195
|
|
|
66
196
|
## Roadmap
|
|
67
|
-
- ✅ Upgrade to use `lit 2`
|
|
68
|
-
- Pre Rendering / Server Side Rendering (SSR) of RapiDoc
|
|
69
|
-
- Improve PDF generation of OpenAPI spec Using RapiPDF
|
|
70
|
-
- Create a Command Line interface (CLI) to make it automation friendly
|
|
71
|
-
- Add localization support
|
|
72
|
-
- Follow Web Content Accessibility Guidelines (WCAG 2)
|
|
73
|
-
- Improve Homepage, Documentation and Examples
|
|
74
|
-
- Create groundwork for automated testing
|
|
75
|
-
- Create a live playground (Something like swagger editor)
|
|
76
|
-
- Create a short animation/video to show how RapiDoc/RapiPDF works
|
|
77
197
|
|
|
198
|
+
- [x] Modernize project dependencies (Vite + Astro + Node 22+)
|
|
199
|
+
- [x] Restructure as a multi-package Monorepo
|
|
200
|
+
- [ ] Build `rapidoc-cli` for OpenAPI linting and local zero-config previews
|
|
201
|
+
- [ ] Build `rapidoc-portal` with PocketBase for developer API portals
|
|
202
|
+
- [ ] Automated visual regression testing suite with Playwright
|
|
203
|
+
- [ ] Web Content Accessibility Guidelines (WCAG 2.1) compliance enhancements
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
MIT © [Mrinmoy Majumdar](https://github.com/mrin9)
|