rapidoc 11.0.1 → 12.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 +46 -31
- package/dist/rapidoc-min.js +1424 -213
- package/dist/rapidoc-static-min.js +13542 -0
- package/package.json +47 -35
- package/src/components/api-request.ts +869 -0
- package/src/components/api-response.ts +509 -0
- package/src/components/json-tree.ts +171 -0
- package/src/components/schema-base-element.ts +315 -0
- package/src/components/schema-table.ts +430 -0
- package/src/components/schema-tree.ts +386 -0
- package/src/components/tag-input.ts +184 -0
- package/src/index.js +6 -0
- package/src/oauth-receiver.ts +29 -0
- package/src/rapidoc-mini.ts +582 -0
- package/src/rapidoc.ts +1808 -0
- package/src/static/index.d.ts +149 -0
- package/src/static/index.js +62 -0
- package/src/static/navigation.js +497 -0
- package/src/static/render.js +490 -0
- package/src/static/serializer.js +216 -0
- package/src/styles/auth-styles.js +318 -0
- package/src/styles/border-styles.js +24 -0
- package/src/styles/css-bundle.js +129 -0
- package/src/styles/custom-styles.js +8 -0
- package/src/styles/dialog-box-styles.js +102 -0
- package/src/styles/endpoint-styles.js +559 -0
- package/src/styles/flex-styles.js +16 -0
- package/src/styles/font-styles.js +432 -0
- package/src/styles/info-styles.js +36 -0
- package/src/styles/input-styles.js +555 -0
- package/src/styles/layout-styles.js +396 -0
- package/src/styles/microlighter-styles.js +99 -0
- package/src/styles/nav-styles.js +609 -0
- package/src/styles/param-list-styles.js +261 -0
- package/src/styles/schema-styles.js +288 -0
- package/src/styles/tab-styles.js +106 -0
- package/src/styles/theme-tokens.js +582 -0
- package/src/templates/advanced-search-dialog-template.js +94 -0
- package/src/templates/api-response-template.js +219 -0
- package/src/templates/callback-template.js +86 -0
- package/src/templates/code-samples-template.js +52 -0
- package/src/templates/components-template.js +86 -0
- package/src/templates/downloads-template.js +85 -0
- package/src/templates/endpoint-template.js +386 -0
- package/src/templates/expanded-endpoint-template.js +266 -0
- package/src/templates/focused-endpoint-template.js +145 -0
- package/src/templates/header-template.js +92 -0
- package/src/templates/logo-template.js +21 -0
- package/src/templates/main-body-template.js +102 -0
- package/src/templates/navbar-template.js +489 -0
- package/src/templates/overview-template.js +104 -0
- package/src/templates/request-body-template.js +651 -0
- package/src/templates/request-params-template.js +474 -0
- package/src/templates/security-scheme-template.js +1263 -0
- package/src/templates/server-template.js +152 -0
- package/src/utils/auto-color-scheme.js +99 -0
- package/src/utils/bind-navbar.js +175 -0
- package/src/utils/color-utils.js +59 -0
- package/src/utils/common-utils.js +191 -0
- package/src/utils/curl-utils.js +123 -0
- package/src/utils/highlighter.js +416 -0
- package/src/utils/markdown-utils.js +110 -0
- package/src/utils/mcp/common.js +467 -0
- package/src/utils/mcp/generators/csharp.js +242 -0
- package/src/utils/mcp/generators/go.js +298 -0
- package/src/utils/mcp/generators/java.js +330 -0
- package/src/utils/mcp/generators/python.js +248 -0
- package/src/utils/mcp/generators/rust.js +281 -0
- package/src/utils/mcp/generators/typescript.js +290 -0
- package/src/utils/mcp-generator.js +143 -0
- package/src/utils/mock-interceptor.js +508 -0
- package/src/utils/oauth-utils.js +87 -0
- package/src/utils/request-utils.js +203 -0
- package/src/utils/response-utils.js +203 -0
- package/src/utils/sanitize.js +57 -0
- package/src/utils/schema-utils.js +1927 -0
- package/src/utils/slugger.js +189 -0
- package/src/utils/spec-parser.js +915 -0
- package/src/utils/url-utils.js +211 -0
- package/src/utils/xml-utils.js +61 -0
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Include the script in your HTML page and use the `<rapi-doc>` custom element:
|
|
|
62
62
|
This repository is structured as a **Monorepo** using workspaces, compatible with **Node/npm**, **pnpm**, and **Bun**:
|
|
63
63
|
|
|
64
64
|
```text
|
|
65
|
-
|
|
65
|
+
rapidoc/
|
|
66
66
|
├── packages/
|
|
67
67
|
│ ├── rapidoc/ # Core Web Component library (published as "rapidoc")
|
|
68
68
|
│ │ ├── src/ # Web component source code (Lit + modern ESM)
|
|
@@ -70,7 +70,7 @@ astro-rapidoc/
|
|
|
70
70
|
│ │ ├── package.json # Library package config
|
|
71
71
|
│ │ └── vite.config.mjs # Dedicated library build config
|
|
72
72
|
│ │
|
|
73
|
-
│ ├── rapidoc-cli/ #
|
|
73
|
+
│ ├── rapidoc-cli/ # The `rapidoc` command (init, dev, build, validate, migrate)
|
|
74
74
|
│ │ ├── src/ # CLI source code
|
|
75
75
|
│ │ └── package.json
|
|
76
76
|
│ │
|
|
@@ -100,11 +100,14 @@ astro-rapidoc/
|
|
|
100
100
|
## Development & Build Instructions
|
|
101
101
|
|
|
102
102
|
### Prerequisites
|
|
103
|
+
|
|
103
104
|
- **Node.js**: `>= 22.12.0` (or [Bun](https://bun.sh/))
|
|
104
105
|
- **npm** (or `bun`)
|
|
105
106
|
|
|
106
107
|
### 1. Installation
|
|
108
|
+
|
|
107
109
|
Clone the repository and install dependencies across all workspaces:
|
|
110
|
+
|
|
108
111
|
```bash
|
|
109
112
|
git clone https://github.com/rapi-doc/RapiDoc.git
|
|
110
113
|
cd RapiDoc
|
|
@@ -112,7 +115,9 @@ npm install
|
|
|
112
115
|
```
|
|
113
116
|
|
|
114
117
|
### 2. Development Server & Live Debugging
|
|
118
|
+
|
|
115
119
|
Start the local documentation and interactive examples showcase:
|
|
120
|
+
|
|
116
121
|
```bash
|
|
117
122
|
# Start dev server (http://localhost:4321)
|
|
118
123
|
npm run dev
|
|
@@ -120,6 +125,7 @@ npm run dev
|
|
|
120
125
|
# Stop background dev server
|
|
121
126
|
npm run stop
|
|
122
127
|
```
|
|
128
|
+
|
|
123
129
|
- Open `http://localhost:4321` in your browser.
|
|
124
130
|
- **Live Unminified ES Modules:** In development mode (`npm run dev`), the Astro dev server bypasses pre-compiled production bundles and serves live ES modules directly from `packages/rapidoc/src/index.js`.
|
|
125
131
|
- **Full DevTools & Console Visibility:** All `console.log`, `console.warn`, `console.error`, and `debugger` breakpoints remain completely intact with original file names and exact line numbers (e.g., `rapidoc.js:516`).
|
|
@@ -132,6 +138,7 @@ npm run stop
|
|
|
132
138
|
This monorepo contains multiple packages: the core Web Component library (**`packages/rapidoc`**) and the documentation showcase site (**`docs`**). The build system coordinates them as follows:
|
|
133
139
|
|
|
134
140
|
#### Core Library Production Build (`npm run build:rapidoc`)
|
|
141
|
+
|
|
135
142
|
- **Workspace:** `packages/rapidoc`
|
|
136
143
|
- **Output:** `packages/rapidoc/dist/rapidoc-min.js`
|
|
137
144
|
- Compiles the RapiDoc custom element in library mode using [Vite 6](https://vitejs.dev/).
|
|
@@ -141,6 +148,7 @@ This monorepo contains multiple packages: the core Web Component library (**`pac
|
|
|
141
148
|
- Injects the license and version header banner.
|
|
142
149
|
|
|
143
150
|
#### Core Library Development Build (`npm run build:rapidoc:dev`)
|
|
151
|
+
|
|
144
152
|
- **Workspace:** `packages/rapidoc`
|
|
145
153
|
- **Output:** `packages/rapidoc/dist/rapidoc-min.js` + `packages/rapidoc/dist/rapidoc-min.js.map`
|
|
146
154
|
- Compiles the standalone library bundle with `mode: 'development'`.
|
|
@@ -148,6 +156,7 @@ This monorepo contains multiple packages: the core Web Component library (**`pac
|
|
|
148
156
|
- Useful when you need to test the bundled `<rapi-doc>` script tag artifact in external standalone HTML pages or apps with full DevTools logging.
|
|
149
157
|
|
|
150
158
|
#### Full Monorepo Build (`npm run build`)
|
|
159
|
+
|
|
151
160
|
- **Scope:** Root monorepo
|
|
152
161
|
- Sequentially executes `npm run build:rapidoc` followed by `npm run build:docs`.
|
|
153
162
|
|
|
@@ -175,39 +184,43 @@ Astro documentation and example pages include the component via `<script type="m
|
|
|
175
184
|
All primary commands can be run from the root of the repository:
|
|
176
185
|
|
|
177
186
|
#### Development & Live Preview
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
|
181
|
-
| `npm run
|
|
182
|
-
| `npm run
|
|
187
|
+
|
|
188
|
+
| Command | Workspace | Description |
|
|
189
|
+
| ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
190
|
+
| `npm run dev` | `docs` | Launches Astro documentation & showcase dev server (`http://localhost:4321`) with live unminified RapiDoc ESM directly from source. |
|
|
191
|
+
| `npm run stop` | `docs` | Terminates background Astro dev server processes. |
|
|
192
|
+
| `npm run preview` | `docs` | Previews the production build of the documentation site (`docs/dist`) locally. |
|
|
183
193
|
|
|
184
194
|
#### Building
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
|
188
|
-
| `npm run build
|
|
189
|
-
| `npm run build:rapidoc
|
|
190
|
-
| `npm run build:
|
|
191
|
-
| `npm run build:
|
|
195
|
+
|
|
196
|
+
| Command | Workspace | Description |
|
|
197
|
+
| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------- |
|
|
198
|
+
| `npm run build` | Monorepo | Sequentially builds production RapiDoc library bundle and the Astro documentation site. |
|
|
199
|
+
| `npm run build:rapidoc` | `rapidoc` | Compiles production, minified Web Component bundle to `packages/rapidoc/dist/rapidoc-min.js`. |
|
|
200
|
+
| `npm run build:rapidoc:dev` | `rapidoc` | Compiles unminified Web Component bundle with source maps & console logs to `packages/rapidoc/dist/`. |
|
|
201
|
+
| `npm run build:docs` | `docs` | Builds the production Astro documentation site into `docs/dist/` (and syncs bundle to `generated-docs/`). |
|
|
202
|
+
| `npm run build:size` | `rapidoc` | Builds RapiDoc with `ANALYZE=true` and opens an interactive bundle visualizer (`dist/stats.html`). |
|
|
192
203
|
|
|
193
204
|
#### Testing & Benchmarks
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
|
197
|
-
| `npm run test:
|
|
198
|
-
| `npm run test:
|
|
205
|
+
|
|
206
|
+
| Command | Workspace | Description |
|
|
207
|
+
| --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
208
|
+
| `npm run test:unit` | Monorepo | Runs Node.js native unit tests (`tests/unit/*.test.js`) for schema parsers and AST converters. |
|
|
209
|
+
| `npm run test:perf` | Monorepo | Runs spec parsing, circular ref, and dereferencing benchmarks (`tests/perf/benchmark.js`). |
|
|
210
|
+
| `npm run test:render` | Monorepo | Measures headless browser rendering performance across render styles using Puppeteer (`tests/perf/render-benchmark.js`). |
|
|
199
211
|
|
|
200
212
|
#### Code Quality & Formatting
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
|
204
|
-
| `npm run
|
|
205
|
-
| `npm run format`
|
|
206
|
-
| `npm run format-fix` | Monorepo
|
|
213
|
+
|
|
214
|
+
| Command | Workspace | Description |
|
|
215
|
+
| -------------------- | --------- | -------------------------------------------------------------------------------------- |
|
|
216
|
+
| `npm run lint` | Monorepo | Runs oxlint (default rules, no config) across packages, docs, tests and scripts. |
|
|
217
|
+
| `npm run format` | Monorepo | Checks formatting with oxfmt (default style) across packages, docs, tests and scripts. |
|
|
218
|
+
| `npm run format-fix` | Monorepo | Formats the same files with oxfmt. |
|
|
207
219
|
|
|
208
220
|
#### Publishing
|
|
209
|
-
|
|
210
|
-
|
|
221
|
+
|
|
222
|
+
| Command | Workspace | Description |
|
|
223
|
+
| ------------------------- | --------- | ---------------------------------------------------- |
|
|
211
224
|
| `npm run publish:rapidoc` | `rapidoc` | Publishes the `rapidoc` package to the npm registry. |
|
|
212
225
|
|
|
213
226
|
---
|
|
@@ -217,7 +230,9 @@ All primary commands can be run from the root of the repository:
|
|
|
217
230
|
The documentation site is built with modern **Astro** using clean, extensionless URLs (`/api`, `/examples`, `/list`, `/quickstart`).
|
|
218
231
|
|
|
219
232
|
### Deployment via GitHub Actions
|
|
220
|
-
|
|
233
|
+
|
|
234
|
+
When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/mrin/work/rapidoc/.github/workflows/deploy-docs.yml) GitHub Action automatically:
|
|
235
|
+
|
|
221
236
|
1. Compiles the `rapidoc` library bundle (`packages/rapidoc/dist/rapidoc-min.js`).
|
|
222
237
|
2. Builds the Astro documentation site into `docs/dist/` (`npm run build`).
|
|
223
238
|
3. Deploys the static output directory (`docs/dist/`) directly to **GitHub Pages** using `@actions/deploy-pages`.
|
|
@@ -231,9 +246,9 @@ When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/m
|
|
|
231
246
|
|
|
232
247
|
OpenAPI specs are organized inside `docs/public/` based on their visibility and purpose:
|
|
233
248
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
249
|
+
- **`docs/public/specs/`**: Public showcase specs referenced in [example-list.yaml](file:///Users/mrin/work/rapidoc/docs/src/data/example-list.yaml) and displayed on `rapidocui.com` (e.g., `petstore.yaml`, `code-highlight.yaml`, `auth.yaml`).
|
|
250
|
+
- **`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`).
|
|
251
|
+
- **`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`).
|
|
237
252
|
|
|
238
253
|
---
|
|
239
254
|
|