@t0.labs/daxta 0.5.0 → 0.5.2
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 +303 -127
- package/assets/empty.html +4 -4
- package/assets/example.html +54 -230
- package/assets/viewer.html +53 -27
- package/dist/build/build-spec.d.ts +3 -1
- package/dist/build/build-spec.js +6 -4
- package/dist/cli/install.js +16 -13
- package/dist/cli/main.js +15 -15
- package/dist/cli/migrate.js +2 -2
- package/dist/cli/titles.js +3 -3
- package/dist/cli/tree.d.ts +1 -1
- package/dist/cli/tree.js +4 -4
- package/dist/cli/ui.js +1 -1
- package/dist/cli/uninstall.js +16 -6
- package/dist/config.d.ts +3 -3
- package/dist/config.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/jest/global-teardown.d.ts +2 -2
- package/dist/jest/global-teardown.js +3 -3
- package/dist/jest/reporter.d.ts +1 -1
- package/dist/jest/reporter.js +6 -7
- package/dist/serve/index.d.ts +2 -2
- package/dist/serve/index.js +8 -6
- package/dist/serve/middleware.d.ts +4 -4
- package/dist/serve/middleware.js +6 -6
- package/dist/serve/paths.d.ts +8 -0
- package/dist/serve/paths.js +19 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,224 +1,400 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.png" width="88" alt="DAxTA" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">DAxTA</h1>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center"><strong>API Test → API Documentation</strong></p>
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
You already wrote the tests.<br />
|
|
11
|
+
Don't document the same thing twice.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/@t0.labs/daxta"><img alt="npm" src="https://img.shields.io/npm/v/@t0.labs/daxta?color=111111&label=npm&logo=npm" /></a>
|
|
16
|
+
<a href="https://nodejs.org"><img alt="node" src="https://img.shields.io/node/v/@t0.labs/daxta?color=111111&label=node" /></a>
|
|
17
|
+
<a href="LICENSE"><img alt="license" src="https://img.shields.io/npm/l/@t0.labs/daxta?color=111111" /></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
DAxTA turns your existing **NestJS API integration tests** into living API documentation.
|
|
23
|
+
|
|
24
|
+
Your tests already know the requests, responses, status codes, headers, validation failures, authentication scenarios, omitted fields, and edge cases of your API.
|
|
25
|
+
|
|
26
|
+
DAxTA captures that real traffic while your tests run and turns it into interactive **OpenAPI documentation** on your application at `/api-docs`.
|
|
27
|
+
|
|
28
|
+
**No duplicate API definitions. No manually maintained examples. No documentation-specific decorators.**
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { apiDocs, generateApiDocs } from '@t0.labs/daxta';
|
|
32
|
+
|
|
33
|
+
await generateApiDocs();
|
|
34
|
+
apiDocs(app);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Why DAxTA?
|
|
40
|
+
|
|
41
|
+
When you build an API, you already describe its behavior in your tests.
|
|
42
|
+
|
|
43
|
+
Your integration tests know:
|
|
44
|
+
|
|
45
|
+
- what request is sent
|
|
46
|
+
- what response should be returned
|
|
47
|
+
- which status code is expected
|
|
48
|
+
- which headers are required
|
|
49
|
+
- positive scenarios
|
|
50
|
+
- negative scenarios
|
|
51
|
+
- invalid inputs
|
|
52
|
+
- omitted fields
|
|
53
|
+
- authentication failures
|
|
54
|
+
- edge cases
|
|
55
|
+
|
|
56
|
+
Then we often define much of the same information **again** for Swagger, Postman, or another API documentation tool.
|
|
57
|
+
|
|
58
|
+
DAxTA removes that duplication.
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
Write API
|
|
62
|
+
↓
|
|
63
|
+
Write tests
|
|
64
|
+
↓
|
|
65
|
+
Run tests
|
|
66
|
+
↓
|
|
67
|
+
DAxTA captures real API behavior
|
|
68
|
+
↓
|
|
69
|
+
Interactive /api-docs
|
|
70
|
+
↓
|
|
71
|
+
OpenAPI → Postman / other tools
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
8
75
|
|
|
9
76
|
## What you get
|
|
10
77
|
|
|
78
|
+
| From your tests | In DAxTA |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| Real request / response pairs | Interactive `/api-docs` UI |
|
|
81
|
+
| Positive scenarios | Success examples |
|
|
82
|
+
| Negative scenarios | Error examples |
|
|
83
|
+
| Validation failures | Invalid cases |
|
|
84
|
+
| Authentication scenarios | Recorded headers |
|
|
85
|
+
| Omitted / optional fields | DTO field metadata |
|
|
86
|
+
| Status codes | Executable API calls |
|
|
87
|
+
| Multiple test cases | Multiple examples per operation |
|
|
88
|
+
| Recorded API set | OpenAPI + Postman export |
|
|
89
|
+
|
|
90
|
+
Different tests for the same endpoint automatically become different API examples.
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
POST /v1/users
|
|
11
94
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
95
|
+
├── 201 User created
|
|
96
|
+
├── 400 Invalid email
|
|
97
|
+
├── 400 Missing required field
|
|
98
|
+
├── 401 Missing authentication
|
|
99
|
+
└── 409 User already exists
|
|
100
|
+
```
|
|
17
101
|
|
|
102
|
+
These examples come from **actual test executions**, not manually maintained documentation.
|
|
18
103
|
|
|
19
|
-
|
|
104
|
+
---
|
|
20
105
|
|
|
21
106
|
## How it works
|
|
22
107
|
|
|
23
108
|
```text
|
|
24
109
|
your Jest suite
|
|
25
|
-
│
|
|
110
|
+
│
|
|
111
|
+
│ supertest / superagent
|
|
112
|
+
▼
|
|
113
|
+
your real NestJS endpoints
|
|
114
|
+
│
|
|
115
|
+
│ DAxTA records traffic
|
|
26
116
|
▼
|
|
27
|
-
|
|
28
|
-
│
|
|
117
|
+
recorded API scenarios
|
|
118
|
+
│
|
|
119
|
+
│ no OpenAPI rebuild mid-run
|
|
29
120
|
▼
|
|
30
|
-
onRunComplete
|
|
121
|
+
onRunComplete
|
|
31
122
|
│
|
|
123
|
+
│ one full build
|
|
32
124
|
▼
|
|
33
|
-
|
|
125
|
+
OpenAPI + DAxTA UI
|
|
126
|
+
│
|
|
127
|
+
▼
|
|
128
|
+
http://localhost:3000/api-docs
|
|
34
129
|
```
|
|
35
130
|
|
|
36
|
-
1. **Install** attaches DAxTA
|
|
37
|
-
|
|
38
|
-
|
|
131
|
+
1. **Install** attaches DAxTA to Jest using `setupFilesAfterEnv` and a reporter.
|
|
132
|
+
|
|
133
|
+
Your existing `test:integration` command remains the entrypoint. DAxTA does not wrap your test process.
|
|
39
134
|
|
|
135
|
+
2. **Run your tests normally.**
|
|
40
136
|
|
|
137
|
+
DAxTA records the real HTTP traffic generated by your tests.
|
|
41
138
|
|
|
42
|
-
|
|
139
|
+
3. **When Jest finishes**, DAxTA performs a single documentation build.
|
|
43
140
|
|
|
44
|
-
|
|
141
|
+
4. `apiDocs(app)` mounts the generated documentation on your NestJS application when `DAXTA_DOCS=true`.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## What DAxTA covers
|
|
146
|
+
|
|
147
|
+
DAxTA records **real HTTP traffic** from NestJS API integration tests.
|
|
148
|
+
|
|
149
|
+
That is the point. Documentation is generated from the same requests your tests already send against the running application — not from controller decorators, and not from unit tests that never hit HTTP.
|
|
150
|
+
|
|
151
|
+
**Covered** — Nest e2e / integration tests that go through **supertest** or **superagent**:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
request(app.getHttpServer())
|
|
155
|
+
.post('/v1/users')
|
|
156
|
+
.set('authorization', token)
|
|
157
|
+
.send({ email: 'ada@example.com' })
|
|
158
|
+
.expect(201);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
If Jest is wired (`setupFilesAfterEnv` + reporter), those hits become `/api-docs` when the suite finishes.
|
|
162
|
+
|
|
163
|
+
**Not covered** — anything that never passes through that HTTP client:
|
|
164
|
+
|
|
165
|
+
| Test style | Recorded? |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| Nest e2e with `request(app.getHttpServer())` | Yes |
|
|
168
|
+
| Service / unit tests (`TestingModule`, no HTTP) | No |
|
|
169
|
+
| `axios`, `fetch`, `got` | No |
|
|
170
|
+
| Playwright / Cypress | No |
|
|
171
|
+
| GraphQL or WebSocket (unless over superagent HTTP) | No |
|
|
172
|
+
|
|
173
|
+
If the test does not hit the API over HTTP the way your clients do, DAxTA has nothing to document. That is intentional: the source of truth is **observed API behavior**, not mocked internals.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Install
|
|
45
178
|
|
|
46
179
|
```bash
|
|
47
180
|
pnpm dlx @t0.labs/daxta install
|
|
48
|
-
# veya
|
|
49
|
-
npx @t0.labs/daxta install
|
|
50
181
|
```
|
|
51
182
|
|
|
52
|
-
|
|
53
|
-
`DAXTA_DOCS=true` otomatik `.env`’e yazılır (yoksa oluşturulur).
|
|
54
|
-
|
|
55
|
-
Sonra:
|
|
183
|
+
or:
|
|
56
184
|
|
|
57
185
|
```bash
|
|
58
|
-
|
|
59
|
-
pnpm start:dev # app portunda /docs (DAXTA_DOCS already set)
|
|
186
|
+
npx @t0.labs/daxta install
|
|
60
187
|
```
|
|
61
188
|
|
|
62
|
-
|
|
63
|
-
|
|
189
|
+
The installer wires `apiDocs(app)` into your NestJS entrypoint, hooks DAxTA into Jest, and writes `daxta.config.ts`.
|
|
190
|
+
|
|
191
|
+
Then run your existing integration tests:
|
|
64
192
|
|
|
65
|
-
|
|
193
|
+
```bash
|
|
194
|
+
pnpm run test:integration
|
|
66
195
|
```
|
|
67
196
|
|
|
68
|
-
|
|
197
|
+
When Jest finishes, your documentation is ready.
|
|
69
198
|
|
|
70
|
-
|
|
199
|
+
Start your application with DAxTA enabled:
|
|
71
200
|
|
|
72
201
|
```bash
|
|
73
|
-
pnpm
|
|
74
|
-
# veya
|
|
75
|
-
npx @t0.labs/daxta uninstall
|
|
202
|
+
DAXTA_DOCS=true pnpm start:dev
|
|
76
203
|
```
|
|
77
204
|
|
|
78
|
-
|
|
205
|
+
Open:
|
|
79
206
|
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
- `.gitignore` / `.env` içindeki DAxTA satırları
|
|
84
|
-
- `@t0.labs/daxta` paketi
|
|
207
|
+
```text
|
|
208
|
+
http://localhost:3000/api-docs
|
|
209
|
+
```
|
|
85
210
|
|
|
86
|
-
|
|
211
|
+
That's it.
|
|
87
212
|
|
|
213
|
+
**Your tests are now your API documentation source.**
|
|
88
214
|
|
|
215
|
+
Flags: `--yes` · `--dry-run` · `--skip-main` · `--skip-dep` · `--main <path>` · `--fast`
|
|
216
|
+
|
|
217
|
+
---
|
|
89
218
|
|
|
90
219
|
## Docs UI
|
|
91
220
|
|
|
92
|
-
|
|
221
|
+
DAxTA provides an interactive API workbench directly on your application.
|
|
93
222
|
|
|
94
|
-
|
|
223
|
+
From `/api-docs` you can:
|
|
95
224
|
|
|
96
|
-
|
|
225
|
+
- browse recorded API operations
|
|
226
|
+
- switch between scenarios generated by different tests
|
|
227
|
+
- inspect real requests and responses
|
|
228
|
+
- inspect status codes and headers
|
|
229
|
+
- inspect required / optional DTO fields
|
|
230
|
+
- send API requests
|
|
231
|
+
- copy requests as cURL
|
|
232
|
+
- work with different environments and header groups
|
|
233
|
+
- select APIs and examples for export
|
|
97
234
|
|
|
98
|
-
|
|
235
|
+
Think of it as an API exploration layer generated from the tests you already wrote.
|
|
99
236
|
|
|
100
|
-
|
|
237
|
+
### Recorded scenarios
|
|
101
238
|
|
|
102
|
-
|
|
239
|
+
Scenarios stay tied to the exact request that produced them — including headers.
|
|
103
240
|
|
|
104
|
-
|
|
105
|
-
DAXTA_DOCS=true # mount /docs (install writes this)
|
|
106
|
-
DAXTA_DOCS=false # no-op (must still be set)
|
|
107
|
-
# unset / empty → throws — make the choice explicit
|
|
108
|
-
```
|
|
241
|
+
For example, an empty authorization header from a `401` test remains empty in that scenario.
|
|
109
242
|
|
|
110
|
-
|
|
243
|
+
Environment tokens only override keys that were actually recorded.
|
|
111
244
|
|
|
112
|
-
|
|
245
|
+
---
|
|
113
246
|
|
|
114
|
-
|
|
115
|
-
daxta install # CLI kurulum (+ sidebar prompts)
|
|
116
|
-
daxta uninstall # CLI kaldırma (komple)
|
|
117
|
-
daxta migrate # paket bump sonrası upgrade (+ sidebar prompts)
|
|
118
|
-
daxta build # OpenAPI/HTML rebuild
|
|
119
|
-
daxta serve # standalone viewer (opsiyonel)
|
|
120
|
-
daxta tree # sidebar / example tercihlerini yeniden sor
|
|
121
|
-
daxta fields … # field map export
|
|
122
|
-
daxta call … # CLI Try-it
|
|
123
|
-
```
|
|
247
|
+
## DTO fields
|
|
124
248
|
|
|
125
|
-
|
|
249
|
+
Field metadata is derived from `class-validator` / `class-transformer` DTO metadata together with observed traffic.
|
|
126
250
|
|
|
127
|
-
|
|
251
|
+
```text
|
|
252
|
+
email required
|
|
253
|
+
password required
|
|
254
|
+
firstName optional
|
|
255
|
+
lastName optional
|
|
256
|
+
```
|
|
128
257
|
|
|
129
|
-
|
|
130
|
-
| --- | --- |
|
|
131
|
-
| `treeLayout` | `role-resource` (`v1 › admin › baskets`) or `resource-role` (`v1 › baskets › admin`) — sidebar **and** Postman export folders |
|
|
132
|
-
| `treeSkipParams` | Don’t nest folders under `{id}` (recommended `true`) |
|
|
133
|
-
| `envPresets` | Multi-base Try-it presets (`local` / `staging` / `production` + optional variables) |
|
|
134
|
-
| `exampleLabelStyle` | OpenAPI example labels: `status-title-case` / `status-case` / `full` |
|
|
258
|
+
This allows DAxTA to understand required and optional fields without another documentation-specific definition of the same contract.
|
|
135
259
|
|
|
136
|
-
|
|
260
|
+
---
|
|
137
261
|
|
|
138
|
-
|
|
262
|
+
## OpenAPI export
|
|
139
263
|
|
|
140
|
-
|
|
264
|
+
DAxTA is not limited to `/api-docs`.
|
|
141
265
|
|
|
142
|
-
|
|
266
|
+
You can select the **APIs and examples** you want, combine them with the appropriate **environment and header groups**, and export using the **OpenAPI** spec plus a **Postman Collection**.
|
|
143
267
|
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
268
|
+
```text
|
|
269
|
+
Tests
|
|
270
|
+
↓
|
|
271
|
+
DAxTA
|
|
272
|
+
↓
|
|
273
|
+
Select APIs + Examples
|
|
274
|
+
↓
|
|
275
|
+
Environment + Header Groups
|
|
276
|
+
↓
|
|
277
|
+
OpenAPI / Postman
|
|
278
|
+
↓
|
|
279
|
+
Other tools
|
|
150
280
|
```
|
|
151
281
|
|
|
152
|
-
|
|
153
|
-
- Serving the app only auto-fills **local** (or sole) preset — staging/production URLs are not overwritten
|
|
154
|
-
- First `daxta build` seeds `daxta/viewer-store.json` from `envPresets` if the file is missing
|
|
155
|
-
- Runtime edits still persist via `GET/PUT {docsPath}/env.json`
|
|
282
|
+
This also allows you to create customized API sets without exposing the entire `/api-docs` interface from your service.
|
|
156
283
|
|
|
157
|
-
|
|
284
|
+
Your tests remain the source of truth.
|
|
158
285
|
|
|
159
|
-
|
|
286
|
+
**OpenAPI becomes the portable output.**
|
|
160
287
|
|
|
161
|
-
|
|
288
|
+
---
|
|
162
289
|
|
|
163
|
-
|
|
164
|
-
|
|
290
|
+
## `DAXTA_DOCS`
|
|
291
|
+
|
|
292
|
+
DAxTA requires an explicit decision about whether `/api-docs` should be mounted.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
DAXTA_DOCS=true # mount /api-docs
|
|
296
|
+
DAXTA_DOCS=false # do not mount /api-docs
|
|
297
|
+
|
|
298
|
+
# unset / empty → throws
|
|
165
299
|
```
|
|
166
300
|
|
|
167
|
-
|
|
301
|
+
This makes exposing API documentation an explicit application decision.
|
|
168
302
|
|
|
169
|
-
|
|
303
|
+
`DAXTA_DOCS=false` does not remove `@t0.labs/daxta` from your Node image. It only prevents `/api-docs` from being mounted.
|
|
170
304
|
|
|
171
|
-
|
|
305
|
+
The path is configurable via `docsPath` in `daxta.config.ts` (default `/api-docs`).
|
|
172
306
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Commands
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
daxta install # one-shot project setup, including sidebar layout
|
|
313
|
+
daxta uninstall # remove DAxTA wiring from the project
|
|
314
|
+
daxta migrate # upgrade integration after a package bump
|
|
315
|
+
daxta generate # rebuild OpenAPI + UI from recorded traffic
|
|
316
|
+
daxta serve # optional standalone viewer
|
|
317
|
+
daxta tree # reconfigure the /api-docs sidebar
|
|
318
|
+
daxta titles # align test titles with API docs examples
|
|
319
|
+
daxta fields … # export the field map for an operation
|
|
320
|
+
daxta call … # execute an API operation from the CLI
|
|
176
321
|
```
|
|
177
322
|
|
|
178
|
-
|
|
323
|
+
`daxta build` is an alias of `daxta generate`.
|
|
179
324
|
|
|
180
|
-
|
|
325
|
+
For most NestJS applications, `apiDocs(app)` is preferred over `daxta serve`.
|
|
181
326
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
| `GET /…/mock-tbs/:id` | Find One Mock Tbs By Id |
|
|
186
|
-
| `POST /…/mock-tbs` | Create Mock Tbs |
|
|
187
|
-
| `PATCH /…/mock-tbs/:id` | Update Mock Tbs By Id |
|
|
188
|
-
| `POST /…/products/bulk` | Create Bulk Products |
|
|
189
|
-
| `POST /…/validator/tax-id/validate` | Validate Tax Id |
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Sidebar order
|
|
190
330
|
|
|
191
|
-
|
|
331
|
+
```bash
|
|
332
|
+
daxta tree
|
|
333
|
+
```
|
|
192
334
|
|
|
193
|
-
|
|
335
|
+
controls how API paths are organized inside `/api-docs`.
|
|
194
336
|
|
|
195
|
-
|
|
337
|
+
```text
|
|
338
|
+
/v1/admin/baskets
|
|
196
339
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
| Positive `it()` | `{creates\|returns\|updates\|…} … when {diff}` | `creates mock tbs TRNC record when cyprus payload shape` |
|
|
200
|
-
| Error `it()` | `returns error when {diff}` | `returns error when tax id already exists in mock TBS` |
|
|
201
|
-
| Invalid fields | leave interpolated | `` `${property} - should not be ${description}` `` |
|
|
202
|
-
| Docs / Postman | `{status} — {after when}` | `201 — cyprus payload shape` |
|
|
340
|
+
1) URL order
|
|
341
|
+
v1 › admin › baskets
|
|
203
342
|
|
|
204
|
-
|
|
343
|
+
2) Resource-first
|
|
344
|
+
v1 › baskets › admin
|
|
205
345
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
daxta titles --yes # rewrite every hit with the recommended name
|
|
209
|
-
daxta titles --check # report only
|
|
346
|
+
3) Custom
|
|
347
|
+
…
|
|
210
348
|
```
|
|
211
349
|
|
|
350
|
+
The selected structure is stored in `daxta.config.ts` as `treeLayout` and `treePathOverrides`.
|
|
212
351
|
|
|
352
|
+
Then rebuild:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
daxta generate
|
|
356
|
+
```
|
|
213
357
|
|
|
358
|
+
---
|
|
214
359
|
|
|
215
360
|
## API
|
|
216
361
|
|
|
217
362
|
```ts
|
|
218
|
-
import {
|
|
219
|
-
|
|
220
|
-
|
|
363
|
+
import {
|
|
364
|
+
apiDocs,
|
|
365
|
+
apiDocsHandler,
|
|
366
|
+
generateApiDocs,
|
|
367
|
+
serveApiDocs,
|
|
368
|
+
} from '@t0.labs/daxta';
|
|
369
|
+
|
|
370
|
+
await generateApiDocs(); // OpenAPI spec + HTML from recorded test hits
|
|
371
|
+
apiDocs(app); // preferred — same origin as your API
|
|
221
372
|
app.use(apiDocsHandler()); // Express-style mount
|
|
222
|
-
serveApiDocs({ port: 5199 }); // standalone
|
|
373
|
+
serveApiDocs({ port: 5199 }); // standalone viewer
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## The idea behind DAxTA
|
|
379
|
+
|
|
380
|
+
The idea is simple.
|
|
381
|
+
|
|
382
|
+
If your integration test already proves that:
|
|
383
|
+
|
|
384
|
+
```text
|
|
385
|
+
this request
|
|
386
|
+
↓
|
|
387
|
+
produces this response
|
|
388
|
+
↓
|
|
389
|
+
with this status code
|
|
223
390
|
```
|
|
224
391
|
|
|
392
|
+
then the documentation already exists.
|
|
393
|
+
|
|
394
|
+
It is just trapped inside your tests.
|
|
395
|
+
|
|
396
|
+
**DAxTA turns it into something you can explore, execute, export, and share.**
|
|
397
|
+
|
|
398
|
+
<p align="center"><strong>API Test → API Documentation</strong></p>
|
|
399
|
+
|
|
400
|
+
<p align="center">You already wrote the tests. Let DAxTA write the docs.</p>
|
package/assets/empty.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>
|
|
6
|
+
<title>API Documentation</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgPHN0eWxlPgogICAgLmJnIHsgZmlsbDogI2ZmZmZmZjsgfQogICAgLmZnIHsgZmlsbDogIzExMTExMTsgfQogICAgLnJpbmcgeyBmaWxsOiBub25lOyBzdHJva2U6ICMxMTExMTE7IHN0cm9rZS13aWR0aDogMS4yNTsgfQogICAgQG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgewogICAgICAuYmcgeyBmaWxsOiAjMTExMTExOyB9CiAgICAgIC5mZyB7IGZpbGw6ICNmZmZmZmY7IH0KICAgICAgLnJpbmcgeyBzdHJva2U6ICNmZmZmZmY7IH0KICAgIH0KICA8L3N0eWxlPgogIDxyZWN0IGNsYXNzPSJiZyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNyIvPgogIDxyZWN0IGNsYXNzPSJyaW5nIiB4PSIwLjYiIHk9IjAuNiIgd2lkdGg9IjMwLjgiIGhlaWdodD0iMzAuOCIgcng9IjYuNCIvPgogIDxwYXRoIGNsYXNzPSJmZyIgZD0iTTQuMiA1LjIgMTQuMiA4Ljh2NC4yQTQuMiA0LjIgMCAwIDEgMTQuMiAyMS40djRMNC4yIDI2LjhaIi8+CiAgPHBhdGggY2xhc3M9ImZnIiBkPSJNMjcuOCA1LjIgMTcuOCA4Ljh2NC4yQTQuMiA0LjIgMCAwIDAgMTcuOCAyMS40djRMMjcuOCAyNi44WiIvPgo8L3N2Zz4K" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
@@ -134,16 +134,16 @@
|
|
|
134
134
|
</head>
|
|
135
135
|
<body>
|
|
136
136
|
<header class="topnav">
|
|
137
|
-
<span class="nav-meta">/docs</span>
|
|
137
|
+
<span class="nav-meta">/api-docs</span>
|
|
138
138
|
</header>
|
|
139
139
|
<main class="stage">
|
|
140
140
|
<div class="panel">
|
|
141
141
|
<p class="kicker">Waiting</p>
|
|
142
|
-
<h1>No documentation yet</h1>
|
|
142
|
+
<h1>No API documentation yet</h1>
|
|
143
143
|
<p>This page publishes when API traffic has been recorded. Run your integration tests, then refresh.</p>
|
|
144
144
|
<ol class="steps">
|
|
145
145
|
<li><span class="n">1</span><span>Run the integration suite that hits your API.</span></li>
|
|
146
|
-
<li><span class="n">2</span><span>DAxTA writes
|
|
146
|
+
<li><span class="n">2</span><span>DAxTA writes API docs from those requests and responses.</span></li>
|
|
147
147
|
<li><span class="n">3</span><span>Reload this page to open the workbench.</span></li>
|
|
148
148
|
</ol>
|
|
149
149
|
<pre class="cmd">pnpm run test:integration</pre>
|