@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/assets/example.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="apple-touch-icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgPHN0eWxlPgogICAgLmJnIHsgZmlsbDogI2ZmZmZmZjsgfQogICAgLmZnIHsgZmlsbDogIzExMTExMTsgfQogICAgLnJpbmcgeyBmaWxsOiBub25lOyBzdHJva2U6ICMxMTExMTE7IHN0cm9rZS13aWR0aDogMS4yNTsgfQogICAgQG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgewogICAgICAuYmcgeyBmaWxsOiAjMTExMTExOyB9CiAgICAgIC5mZyB7IGZpbGw6ICNmZmZmZmY7IH0KICAgICAgLnJpbmcgeyBzdHJva2U6ICNmZmZmZmY7IH0KICAgIH0KICA8L3N0eWxlPgogIDxyZWN0IGNsYXNzPSJiZyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNyIvPgogIDxyZWN0IGNsYXNzPSJyaW5nIiB4PSIwLjYiIHk9IjAuNiIgd2lkdGg9IjMwLjgiIGhlaWdodD0iMzAuOCIgcng9IjYuNCIvPgogIDxwYXRoIGNsYXNzPSJmZyIgZD0iTTQuMiA1LjIgMTQuMiA4Ljh2NC4yQTQuMiA0LjIgMCAwIDEgMTQuMiAyMS40djRMNC4yIDI2LjhaIi8+CiAgPHBhdGggY2xhc3M9ImZnIiBkPSJNMjcuOCA1LjIgMTcuOCA4Ljh2NC4yQTQuMiA0LjIgMCAwIDAgMTcuOCAyMS40djRMMjcuOCAyNi44WiIvPgo8L3N2Zz4K" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
@@ -79,16 +79,29 @@
|
|
|
79
79
|
text-overflow: ellipsis;
|
|
80
80
|
color: var(--obsidian);
|
|
81
81
|
}
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
.prefix-bar {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
gap: 4px;
|
|
86
|
+
margin: 0 0 8px;
|
|
87
|
+
flex: none;
|
|
88
|
+
}
|
|
89
|
+
.prefix-bar[hidden] { display: none; }
|
|
90
|
+
.prefix-chip {
|
|
91
|
+
height: 22px;
|
|
92
|
+
padding: 0 8px;
|
|
93
|
+
border: 0;
|
|
85
94
|
border-radius: 4px;
|
|
86
|
-
background:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
padding: 0 6px;
|
|
95
|
+
background: transparent;
|
|
96
|
+
color: var(--stone);
|
|
97
|
+
font: 500 11px/22px var(--mono);
|
|
90
98
|
cursor: pointer;
|
|
91
99
|
}
|
|
100
|
+
.prefix-chip:hover { color: var(--obsidian); background: var(--inset); }
|
|
101
|
+
.prefix-chip.on {
|
|
102
|
+
background: var(--inset);
|
|
103
|
+
color: var(--obsidian);
|
|
104
|
+
}
|
|
92
105
|
.nav-tools { display: flex; align-items: center; gap: 8px; justify-self: end; }
|
|
93
106
|
.nav-tools .btn {
|
|
94
107
|
height: 28px;
|
|
@@ -1239,7 +1252,6 @@
|
|
|
1239
1252
|
<header class="topnav">
|
|
1240
1253
|
<div class="brand-wrap">
|
|
1241
1254
|
<div class="brand" id="brand">API</div>
|
|
1242
|
-
<select class="ver-select" id="ver-select" aria-label="API version"></select>
|
|
1243
1255
|
</div>
|
|
1244
1256
|
<div class="ep-nav" id="ep-nav">
|
|
1245
1257
|
<span class="ep-name" id="ep-name"></span>
|
|
@@ -1287,6 +1299,7 @@
|
|
|
1287
1299
|
<span class="search-kbd">/</span>
|
|
1288
1300
|
<div class="search-panel" id="search-panel" role="listbox"></div>
|
|
1289
1301
|
</div>
|
|
1302
|
+
<div class="prefix-bar" id="prefix-bar" hidden></div>
|
|
1290
1303
|
<div class="tree-scroll" id="nav"></div>
|
|
1291
1304
|
<div class="nav-foot"><span>Generated by DAxTA</span><span id="nav-version"></span></div>
|
|
1292
1305
|
</aside>
|
|
@@ -1295,216 +1308,14 @@
|
|
|
1295
1308
|
<div class="ex-dock" id="ex-dock"></div>
|
|
1296
1309
|
</div>
|
|
1297
1310
|
<script>
|
|
1298
|
-
window.__SPEC__ = {
|
|
1299
|
-
"openapi": "3.0.3",
|
|
1300
|
-
"info": {
|
|
1301
|
-
"title": "Token X Onboarding Service",
|
|
1302
|
-
"version": "v1",
|
|
1303
|
-
"x-workspace": "token-x"
|
|
1304
|
-
},
|
|
1305
|
-
"x-viewer": {
|
|
1306
|
-
"workspace": "token-x",
|
|
1307
|
-
"baseUrl": "http://localhost:3000",
|
|
1308
|
-
"docsPath": "/docs",
|
|
1309
|
-
"envPresets": {
|
|
1310
|
-
"local": { "baseUrl": "http://localhost:3000" }
|
|
1311
|
-
}
|
|
1312
|
-
},
|
|
1313
|
-
"servers": [{ "url": "http://localhost:3000" }],
|
|
1314
|
-
"components": {
|
|
1315
|
-
"securitySchemes": {
|
|
1316
|
-
"adminId": { "type": "apiKey", "in": "header", "name": "x-admin-id" }
|
|
1317
|
-
}
|
|
1318
|
-
},
|
|
1319
|
-
"paths": {
|
|
1320
|
-
"/v1/admin/mock-tbs": {
|
|
1321
|
-
"post": {
|
|
1322
|
-
"summary": "Create Mock Tbs",
|
|
1323
|
-
"security": [{ "adminId": [] }],
|
|
1324
|
-
"x-tree-segments": ["v1", "mock-tbs", "admin"],
|
|
1325
|
-
"x-docs": {
|
|
1326
|
-
"title": "Create Mock Tbs",
|
|
1327
|
-
"fields": [
|
|
1328
|
-
{ "name": "taxId", "in": "body", "type": "string", "required": true },
|
|
1329
|
-
{ "name": "terminals", "in": "body", "type": "array<object>", "required": false },
|
|
1330
|
-
{ "name": "terminals[].count", "in": "body", "type": "integer", "required": false }
|
|
1331
|
-
]
|
|
1332
|
-
},
|
|
1333
|
-
"x-scenarios": [
|
|
1334
|
-
{
|
|
1335
|
-
"name": "Creates mock TBS record with counted random model",
|
|
1336
|
-
"group": "POSITIVE CASES",
|
|
1337
|
-
"status": 201,
|
|
1338
|
-
"headers": {
|
|
1339
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1340
|
-
"content-type": "application/json"
|
|
1341
|
-
},
|
|
1342
|
-
"reqBody": { "taxId": "7128961871", "terminals": [{ "count": 2 }] },
|
|
1343
|
-
"resBody": {
|
|
1344
|
-
"statusCode": 201,
|
|
1345
|
-
"success": true,
|
|
1346
|
-
"timestamp": "2026-08-22T23:24:16.571Z",
|
|
1347
|
-
"path": "/v1/admin/mock-tbs",
|
|
1348
|
-
"error": null
|
|
1349
|
-
}
|
|
1350
|
-
},
|
|
1351
|
-
{
|
|
1352
|
-
"name": "Creates mock TBS record with terminal model specs",
|
|
1353
|
-
"group": "POSITIVE CASES",
|
|
1354
|
-
"status": 201,
|
|
1355
|
-
"headers": {
|
|
1356
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1357
|
-
"content-type": "application/json"
|
|
1358
|
-
},
|
|
1359
|
-
"reqBody": { "taxId": "7128961872", "terminals": [{ "count": 1, "model": "PAX-A920" }] },
|
|
1360
|
-
"resBody": {
|
|
1361
|
-
"statusCode": 201,
|
|
1362
|
-
"success": true,
|
|
1363
|
-
"timestamp": "2026-08-22T23:24:18.120Z",
|
|
1364
|
-
"path": "/v1/admin/mock-tbs",
|
|
1365
|
-
"error": null
|
|
1366
|
-
}
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
"name": "Tax id already exists",
|
|
1370
|
-
"group": "SEMANTIC ERROR CASES",
|
|
1371
|
-
"status": 409,
|
|
1372
|
-
"headers": {
|
|
1373
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1374
|
-
"content-type": "application/json"
|
|
1375
|
-
},
|
|
1376
|
-
"reqBody": { "taxId": "7128961871" },
|
|
1377
|
-
"resBody": {
|
|
1378
|
-
"statusCode": 409,
|
|
1379
|
-
"success": false,
|
|
1380
|
-
"path": "/v1/admin/mock-tbs",
|
|
1381
|
-
"error": "Tax id already exists"
|
|
1382
|
-
}
|
|
1383
|
-
},
|
|
1384
|
-
{
|
|
1385
|
-
"name": "Fiscal id does not exist",
|
|
1386
|
-
"group": "SEMANTIC ERROR CASES",
|
|
1387
|
-
"status": 404,
|
|
1388
|
-
"headers": {
|
|
1389
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1390
|
-
"content-type": "application/json"
|
|
1391
|
-
},
|
|
1392
|
-
"reqBody": { "taxId": "0000000000" },
|
|
1393
|
-
"resBody": {
|
|
1394
|
-
"statusCode": 404,
|
|
1395
|
-
"success": false,
|
|
1396
|
-
"path": "/v1/admin/mock-tbs",
|
|
1397
|
-
"error": "Fiscal id does not exist"
|
|
1398
|
-
}
|
|
1399
|
-
},
|
|
1400
|
-
{
|
|
1401
|
-
"name": "taxId should not be array",
|
|
1402
|
-
"group": "INVALID CASES",
|
|
1403
|
-
"status": 400,
|
|
1404
|
-
"headers": {
|
|
1405
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1406
|
-
"content-type": "application/json"
|
|
1407
|
-
},
|
|
1408
|
-
"reqBody": { "taxId": ["7128961871"] },
|
|
1409
|
-
"resBody": {
|
|
1410
|
-
"statusCode": 400,
|
|
1411
|
-
"success": false,
|
|
1412
|
-
"path": "/v1/admin/mock-tbs",
|
|
1413
|
-
"error": "taxId should not be array"
|
|
1414
|
-
}
|
|
1415
|
-
},
|
|
1416
|
-
{
|
|
1417
|
-
"name": "taxId has invalid format",
|
|
1418
|
-
"group": "INVALID CASES",
|
|
1419
|
-
"status": 400,
|
|
1420
|
-
"headers": {
|
|
1421
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1422
|
-
"content-type": "application/json"
|
|
1423
|
-
},
|
|
1424
|
-
"reqBody": { "taxId": "abc" },
|
|
1425
|
-
"resBody": {
|
|
1426
|
-
"statusCode": 400,
|
|
1427
|
-
"success": false,
|
|
1428
|
-
"path": "/v1/admin/mock-tbs",
|
|
1429
|
-
"error": "taxId has invalid format"
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
"name": "terminals is omitted",
|
|
1434
|
-
"group": "OMITTED CASES",
|
|
1435
|
-
"status": 201,
|
|
1436
|
-
"headers": {
|
|
1437
|
-
"x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba",
|
|
1438
|
-
"content-type": "application/json"
|
|
1439
|
-
},
|
|
1440
|
-
"reqBody": { "taxId": "7128961873" },
|
|
1441
|
-
"resBody": {
|
|
1442
|
-
"statusCode": 201,
|
|
1443
|
-
"success": true,
|
|
1444
|
-
"timestamp": "2026-08-22T23:25:01.000Z",
|
|
1445
|
-
"path": "/v1/admin/mock-tbs",
|
|
1446
|
-
"error": null
|
|
1447
|
-
}
|
|
1448
|
-
},
|
|
1449
|
-
{
|
|
1450
|
-
"name": "Headers are missing",
|
|
1451
|
-
"group": "SEMANTIC ERROR CASES - AUTH",
|
|
1452
|
-
"status": 401,
|
|
1453
|
-
"headers": { "content-type": "application/json" },
|
|
1454
|
-
"reqBody": { "taxId": "7128961871" },
|
|
1455
|
-
"resBody": {
|
|
1456
|
-
"statusCode": 401,
|
|
1457
|
-
"success": false,
|
|
1458
|
-
"path": "/v1/admin/mock-tbs",
|
|
1459
|
-
"error": "Unauthorized"
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
]
|
|
1463
|
-
}
|
|
1464
|
-
},
|
|
1465
|
-
"/v1/admin/terminals": {
|
|
1466
|
-
"get": {
|
|
1467
|
-
"summary": "List Terminals",
|
|
1468
|
-
"security": [{ "adminId": [] }],
|
|
1469
|
-
"x-tree-segments": ["v1", "terminal", "admin"],
|
|
1470
|
-
"x-docs": { "title": "List Terminals", "fields": [] },
|
|
1471
|
-
"x-scenarios": [
|
|
1472
|
-
{
|
|
1473
|
-
"name": "Returns terminals for admin",
|
|
1474
|
-
"group": "POSITIVE CASES",
|
|
1475
|
-
"status": 200,
|
|
1476
|
-
"headers": { "x-admin-id": "28c82ecd-645e-4df3-96fe-f45b8adbc5ba" },
|
|
1477
|
-
"resBody": { "statusCode": 200, "success": true, "data": [] }
|
|
1478
|
-
}
|
|
1479
|
-
]
|
|
1480
|
-
}
|
|
1481
|
-
},
|
|
1482
|
-
"/v1/payments": {
|
|
1483
|
-
"post": {
|
|
1484
|
-
"summary": "Create Payment",
|
|
1485
|
-
"x-tree-segments": ["v1", "payments"],
|
|
1486
|
-
"x-docs": { "title": "Create Payment", "fields": [{ "name": "amount", "in": "body", "type": "number", "required": true }] },
|
|
1487
|
-
"x-scenarios": [
|
|
1488
|
-
{
|
|
1489
|
-
"name": "Creates a payment",
|
|
1490
|
-
"group": "POSITIVE CASES",
|
|
1491
|
-
"status": 201,
|
|
1492
|
-
"headers": { "content-type": "application/json" },
|
|
1493
|
-
"reqBody": { "amount": 1200 },
|
|
1494
|
-
"resBody": { "statusCode": 201, "success": true }
|
|
1495
|
-
}
|
|
1496
|
-
]
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1311
|
+
window.__SPEC__ = {"openapi":"3.0.3","info":{"title":"Lumen Library API","version":"2.1.0","description":"Generated from observed test execution","x-workspace":"lumen"},"x-viewer":{"workspace":"lumen","baseUrl":"http://localhost:3000","docsPath":"/api-docs","treeLayout":"role-resource","treeSkipParams":true,"exampleLabelStyle":"status-title-case","envPresets":{"local":{"baseUrl":"http://localhost:3000"},"staging":{"baseUrl":"https://api.staging.lumen.example"},"production":{"baseUrl":"https://api.lumen.example"}}},"servers":[{"url":"http://localhost:3000"}],"tags":[{"name":"titles"},{"name":"copies"},{"name":"holds"},{"name":"loans"},{"name":"rooms"}],"components":{"securitySchemes":{"staffId":{"type":"apiKey","in":"header","name":"x-staff-id"},"patronId":{"type":"apiKey","in":"header","name":"x-patron-id"},"authorization":{"type":"apiKey","in":"header","name":"authorization"}}},"paths":{"/v1/staff/titles":{"post":{"tags":["titles"],"summary":"Create Title","security":[{"staffId":[]}],"x-tree-segments":["v1","titles","staff"],"x-docs":{"title":"Create Title","fields":[{"name":"x-staff-id","in":"header","type":"string","required":true},{"name":"isbn","in":"body","type":"string","required":true},{"name":"name","in":"body","type":"string","required":true},{"name":"copies","in":"body","type":"array\u003cobject>","required":false},{"name":"copies[].count","in":"body","type":"integer","required":false},{"name":"copies[].binding","in":"body","type":"string","required":false}]},"x-scenarios":[{"name":"Creates title when counted paperback copies are provided","group":"POSITIVE CASES","status":201,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"9780141439518","name":"Pride and Prejudice","copies":[{"count":4}]},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":null,"data":{"id":"ttl_01PP","isbn":"9780141439518","copyCount":4}}},{"name":"Creates title when hardcover binding specs are provided","group":"POSITIVE CASES","status":201,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"9780141439518","name":"Pride and Prejudice","copies":[{"count":2,"binding":"hardcover"}]},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":null,"data":{"id":"ttl_01PP","bindings":["hardcover"]}}},{"name":"Returns error when isbn already exists","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"9780141439518","name":"Pride and Prejudice"},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":"ISBN already exists"}},{"name":"Returns error when publisher catalog has no match","group":"SEMANTIC ERROR CASES","status":404,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"0000000000000","name":"Unknown Volume"},"resBody":{"statusCode":404,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":"Publisher catalog has no match"}},{"name":"Returns error when isbn is an array","group":"INVALID CASES","status":400,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":["9780141439518"],"name":"Pride and Prejudice"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":"isbn should not be array"}},{"name":"Returns error when isbn has invalid format","group":"INVALID CASES","status":400,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"abc","name":"Pride and Prejudice"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":"isbn has invalid format"}},{"name":"Creates title when copies are omitted","group":"OMITTED CASES","status":201,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"isbn":"9780061120084","name":"To Kill a Mockingbird"},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":null,"data":{"id":"ttl_01MK","copyCount":0}}},{"name":"Returns error when x-staff-id is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{},"query":{},"headers":{"content-type":"application/json"},"reqBody":{"isbn":"9780141439518","name":"Pride and Prejudice"},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","path":"/v1/staff/titles","error":"Unauthorized"}}]}},"/v1/staff/copies":{"get":{"tags":["copies"],"summary":"List Copies","security":[{"staffId":[]}],"x-tree-segments":["v1","copies","staff"],"x-docs":{"title":"List Copies","fields":[{"name":"x-staff-id","in":"header","type":"string","required":true},{"name":"status","in":"query","type":"string","required":false},{"name":"page","in":"query","type":"integer","required":false},{"name":"limit","in":"query","type":"integer","required":false}]},"x-scenarios":[{"name":"Lists copies when query is valid","group":"POSITIVE CASES","status":200,"pathParams":{},"query":{"status":"SHELVED","page":"1","limit":"20"},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":[{"id":"cpy_01AA","barcode":"LUM-1001","binding":"paperback","status":"SHELVED"},{"id":"cpy_01AB","barcode":"LUM-1002","binding":"hardcover","status":"SHELVED"}],"meta":{"page":1,"limit":20,"total":2}}},{"name":"Lists copies when filters are omitted","group":"OMITTED CASES","status":200,"pathParams":{},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":[],"meta":{"page":1,"limit":20,"total":0}}},{"name":"Returns error when page is not a number","group":"INVALID CASES","status":400,"pathParams":{},"query":{"page":"first"},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"page must be an integer"}},{"name":"Returns error when x-staff-id is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{},"query":{},"headers":{},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]}},"/v1/staff/copies/{copyId}":{"get":{"tags":["copies"],"summary":"Get Copy","security":[{"staffId":[]}],"x-tree-segments":["v1","copies","staff"],"x-docs":{"title":"Get Copy","fields":[{"name":"x-staff-id","in":"header","type":"string","required":true},{"name":"copyId","in":"path","type":"string","required":true}]},"x-scenarios":[{"name":"Returns copy when id exists","group":"POSITIVE CASES","status":200,"pathParams":{"copyId":"cpy_01AA"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"cpy_01AA","barcode":"LUM-1001","binding":"paperback","status":"SHELVED","branch":"river-north"}}},{"name":"Returns error when copy does not exist","group":"SEMANTIC ERROR CASES","status":404,"pathParams":{"copyId":"cpy_missing"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":404,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Copy not found"}},{"name":"Returns error when x-staff-id is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{"copyId":"cpy_01AA"},"query":{},"headers":{},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]},"patch":{"tags":["copies"],"summary":"Update Copy","security":[{"staffId":[]}],"x-tree-segments":["v1","copies","staff"],"x-docs":{"title":"Update Copy","fields":[{"name":"x-staff-id","in":"header","type":"string","required":true},{"name":"copyId","in":"path","type":"string","required":true},{"name":"status","in":"body","type":"string","required":false},{"name":"shelf","in":"body","type":"string","required":false},{"name":"condition.notes","in":"body","type":"string","required":false}]},"x-scenarios":[{"name":"Updates copy when status is valid","group":"POSITIVE CASES","status":200,"pathParams":{"copyId":"cpy_01AA"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"status":"REPAIR","shelf":"B-14","condition":{"notes":"loose spine"}},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"cpy_01AA","status":"REPAIR","shelf":"B-14"}}},{"name":"Returns error when status is unknown","group":"INVALID CASES","status":400,"pathParams":{"copyId":"cpy_01AA"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"status":"LOST-IN-SPACE"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"status must be one of SHELVED, LOANED, REPAIR, WITHDRAWN"}},{"name":"Returns error when copy is already withdrawn","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{"copyId":"cpy_withdrawn"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4","content-type":"application/json"},"reqBody":{"status":"SHELVED"},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Withdrawn copies cannot be reshelved"}}]},"delete":{"tags":["copies"],"summary":"Delete Copy","security":[{"staffId":[]}],"x-tree-segments":["v1","copies","staff"],"x-docs":{"title":"Delete Copy","fields":[{"name":"x-staff-id","in":"header","type":"string","required":true},{"name":"copyId","in":"path","type":"string","required":true}]},"x-scenarios":[{"name":"Deletes copy when it is unused","group":"POSITIVE CASES","status":204,"pathParams":{"copyId":"cpy_01AB"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4"}},{"name":"Returns error when copy is on loan","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{"copyId":"cpy_01AA"},"query":{},"headers":{"x-staff-id":"stf_7c91e2a4"},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Copy is on loan"}},{"name":"Returns error when x-staff-id is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{"copyId":"cpy_01AB"},"query":{},"headers":{},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]}},"/v1/patron/holds":{"post":{"tags":["holds"],"summary":"Create Hold","security":[{"patronId":[]}],"x-tree-segments":["v1","holds","patron"],"x-docs":{"title":"Create Hold","fields":[{"name":"x-patron-id","in":"header","type":"string","required":true},{"name":"titleId","in":"body","type":"string","required":true},{"name":"pickup.branch","in":"body","type":"string","required":true},{"name":"pickup.by","in":"body","type":"string","required":false},{"name":"notes","in":"body","type":"string","required":false}]},"x-scenarios":[{"name":"Creates hold when pickup branch is open","group":"POSITIVE CASES","status":201,"pathParams":{},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"river-north","by":"2026-09-01"},"notes":"large print if available"},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"hld_01PP","status":"QUEUED","position":2}}},{"name":"Returns error when patron already holds this title","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"river-north"}},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"A hold already exists for this title"}},{"name":"Returns error when branch code is invalid","group":"INVALID CASES","status":400,"pathParams":{},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"moon-base"}},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"pickup.branch must be a known branch"}},{"name":"Returns error when titleId is omitted","group":"OMITTED CASES","status":400,"pathParams":{},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"pickup":{"branch":"river-north"}},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"titleId should not be empty"}},{"name":"Returns error when x-patron-id is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{},"query":{},"headers":{"content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"river-north"}},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]}},"/v1/patron/holds/{holdId}":{"get":{"tags":["holds"],"summary":"Get Hold","security":[{"patronId":[]}],"x-tree-segments":["v1","holds","patron"],"x-docs":{"title":"Get Hold","fields":[{"name":"x-patron-id","in":"header","type":"string","required":true},{"name":"holdId","in":"path","type":"string","required":true}]},"x-scenarios":[{"name":"Returns hold when it belongs to patron","group":"POSITIVE CASES","status":200,"pathParams":{"holdId":"hld_01PP"},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"hld_01PP","status":"QUEUED","titleId":"ttl_01PP"}}},{"name":"Returns error when hold belongs to another patron","group":"SEMANTIC ERROR CASES","status":403,"pathParams":{"holdId":"hld_other"},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6"},"resBody":{"statusCode":403,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Forbidden"}}]},"put":{"tags":["holds"],"summary":"Replace Hold","security":[{"patronId":[]}],"x-tree-segments":["v1","holds","patron"],"x-docs":{"title":"Replace Hold","fields":[{"name":"x-patron-id","in":"header","type":"string","required":true},{"name":"holdId","in":"path","type":"string","required":true},{"name":"titleId","in":"body","type":"string","required":true},{"name":"pickup.branch","in":"body","type":"string","required":true},{"name":"pickup.by","in":"body","type":"string","required":false}]},"x-scenarios":[{"name":"Replaces hold when pickup branch is valid","group":"POSITIVE CASES","status":200,"pathParams":{"holdId":"hld_01PP"},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"west-end","by":"2026-09-08"}},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"hld_01PP","pickup":{"branch":"west-end"},"status":"QUEUED"}}},{"name":"Returns error when hold is already ready","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{"holdId":"hld_ready"},"query":{},"headers":{"x-patron-id":"ptr_3b18d0f6","content-type":"application/json"},"reqBody":{"titleId":"ttl_01PP","pickup":{"branch":"west-end"}},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Ready holds cannot be replaced"}}]}},"/v1/loans":{"get":{"tags":["loans"],"summary":"List Loans","security":[{"authorization":[]}],"x-tree-segments":["v1","loans"],"x-docs":{"title":"List Loans","fields":[{"name":"authorization","in":"header","type":"string","required":true},{"name":"from","in":"query","type":"string","required":false},{"name":"to","in":"query","type":"string","required":false},{"name":"status","in":"query","type":"string","required":false},{"name":"cursor","in":"query","type":"string","required":false}]},"x-scenarios":[{"name":"Lists loans when date range is valid","group":"POSITIVE CASES","status":200,"pathParams":{},"query":{"from":"2026-08-01","to":"2026-08-22","status":"OPEN"},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":[{"id":"lon_9f2a","copyId":"cpy_01AA","dueOn":"2026-09-05","status":"OPEN"}],"nextCursor":null}},{"name":"Returns error when from is after to","group":"INVALID CASES","status":400,"pathParams":{},"query":{"from":"2026-08-22","to":"2026-08-01"},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"from must be before to"}},{"name":"Returns error when authorization is missing","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{},"query":{"from":"2026-08-01","to":"2026-08-22"},"headers":{},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]},"post":{"tags":["loans"],"summary":"Create Loan","security":[{"authorization":[]}],"x-tree-segments":["v1","loans"],"x-docs":{"title":"Create Loan","fields":[{"name":"authorization","in":"header","type":"string","required":true},{"name":"copyId","in":"body","type":"string","required":true},{"name":"patronId","in":"body","type":"string","required":true},{"name":"days","in":"body","type":"integer","required":true},{"name":"idempotencyKey","in":"body","type":"string","required":true},{"name":"notice.email","in":"body","type":"string","required":false}]},"x-scenarios":[{"name":"Creates loan when copy is shelved","group":"POSITIVE CASES","status":201,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"copyId":"cpy_01AA","patronId":"ptr_3b18d0f6","days":21,"idempotencyKey":"chk_88","notice":{"email":"reader@example.com"}},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"lon_9f2a","status":"OPEN","dueOn":"2026-09-12"}}},{"name":"Returns open loan when idempotency key is reused","group":"POSITIVE CASES","status":200,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"copyId":"cpy_01AA","patronId":"ptr_3b18d0f6","days":21,"idempotencyKey":"chk_88"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"lon_9f2a","status":"OPEN","dueOn":"2026-09-12"}}},{"name":"Returns error when copy is in repair","group":"SEMANTIC ERROR CASES","status":422,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"copyId":"cpy_repair","patronId":"ptr_3b18d0f6","days":14,"idempotencyKey":"chk_89"},"resBody":{"statusCode":422,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Copy is not available for loan"}},{"name":"Returns error when days is negative","group":"INVALID CASES","status":400,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"copyId":"cpy_01AA","patronId":"ptr_3b18d0f6","days":-1,"idempotencyKey":"chk_90"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"days must be a positive integer"}},{"name":"Returns error when patronId is omitted","group":"OMITTED CASES","status":400,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"copyId":"cpy_01AA","days":21,"idempotencyKey":"chk_91"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"patronId should not be empty"}},{"name":"Returns error when authorization is expired","group":"SEMANTIC ERROR CASES - AUTH","status":401,"pathParams":{},"query":{},"headers":{"authorization":"Bearer expired","content-type":"application/json"},"reqBody":{"copyId":"cpy_01AA","patronId":"ptr_3b18d0f6","days":21,"idempotencyKey":"chk_92"},"resBody":{"statusCode":401,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Unauthorized"}}]}},"/v1/loans/{loanId}":{"get":{"tags":["loans"],"summary":"Get Loan","security":[{"authorization":[]}],"x-tree-segments":["v1","loans"],"x-docs":{"title":"Get Loan","fields":[{"name":"authorization","in":"header","type":"string","required":true},{"name":"loanId","in":"path","type":"string","required":true}]},"x-scenarios":[{"name":"Returns loan when it exists","group":"POSITIVE CASES","status":200,"pathParams":{"loanId":"lon_9f2a"},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"},"resBody":{"statusCode":200,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"lon_9f2a","copyId":"cpy_01AA","patronId":"ptr_3b18d0f6","status":"OPEN","dueOn":"2026-09-12"}}},{"name":"Returns error when loan does not exist","group":"SEMANTIC ERROR CASES","status":404,"pathParams":{"loanId":"lon_missing"},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"},"resBody":{"statusCode":404,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Loan not found"}}]}},"/v1/rooms/bookings":{"post":{"tags":["rooms"],"summary":"Create Booking","security":[{"authorization":[]}],"x-tree-segments":["v1","rooms","bookings"],"x-docs":{"title":"Create Booking","fields":[{"name":"authorization","in":"header","type":"string","required":true},{"name":"roomId","in":"body","type":"string","required":true},{"name":"slot","in":"body","type":"string","required":true},{"name":"seats","in":"body","type":"integer","required":false}]},"x-scenarios":[{"name":"Creates booking when room is free","group":"POSITIVE CASES","status":201,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"roomId":"rm_quiet","slot":"2026-08-24T10:00:00Z","seats":4},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"bkg_9f2a","roomId":"rm_quiet","status":"CONFIRMED"}}},{"name":"Returns error when slot overlaps an existing booking","group":"SEMANTIC ERROR CASES","status":409,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"roomId":"rm_quiet","slot":"2026-08-24T10:00:00Z"},"resBody":{"statusCode":409,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"Room is already booked for this slot"}},{"name":"Returns error when slot is not ISO-8601","group":"INVALID CASES","status":400,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"roomId":"rm_quiet","slot":"tomorrow-morning"},"resBody":{"statusCode":400,"success":false,"timestamp":"2026-08-22T14:08:03.120Z","error":"slot must be an ISO-8601 datetime"}},{"name":"Creates booking when seats are omitted","group":"OMITTED CASES","status":201,"pathParams":{},"query":{},"headers":{"authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…","content-type":"application/json"},"reqBody":{"roomId":"rm_map","slot":"2026-08-24T15:00:00Z"},"resBody":{"statusCode":201,"success":true,"timestamp":"2026-08-22T14:08:03.120Z","data":{"id":"bkg_map","roomId":"rm_map","seats":1,"status":"CONFIRMED"}}}]}}}};
|
|
1501
1312
|
</script>
|
|
1502
1313
|
<script>
|
|
1503
1314
|
const spec = window.__SPEC__ || {};
|
|
1504
1315
|
const viewer = spec["x-viewer"] || {};
|
|
1505
1316
|
const workspace = (spec.info && spec.info["x-workspace"]) || viewer.workspace || "";
|
|
1506
1317
|
const defaultBaseUrlFromSpec = String((viewer.baseUrl || (spec.servers && spec.servers[0] && spec.servers[0].url) || "http://localhost:3000")).replace(/\/$/, "");
|
|
1507
|
-
const docsPathSuffix = String(viewer.docsPath || "/docs").replace(/\/$/, "") || "/docs";
|
|
1318
|
+
const docsPathSuffix = String(viewer.docsPath || "/api-docs").replace(/\/$/, "") || "/api-docs";
|
|
1508
1319
|
|
|
1509
1320
|
const inferBaseUrlFromLocation = () => {
|
|
1510
1321
|
if (typeof location === "undefined") return null;
|
|
@@ -1524,9 +1335,9 @@
|
|
|
1524
1335
|
};
|
|
1525
1336
|
|
|
1526
1337
|
const locationBaseUrl = inferBaseUrlFromLocation();
|
|
1527
|
-
// Prefer the URL that is serving the viewer (strip
|
|
1338
|
+
// Prefer the URL that is serving the viewer (strip the docs path), else fall back to spec.
|
|
1528
1339
|
const defaultBaseUrl = locationBaseUrl || defaultBaseUrlFromSpec;
|
|
1529
|
-
const title = (spec.info && spec.info.title) || "API
|
|
1340
|
+
const title = (spec.info && spec.info.title) || "API Documentation";
|
|
1530
1341
|
const STORE_KEY = "openapi-docs-env:" + (workspace || "default");
|
|
1531
1342
|
const SIDEBAR_STORE_KEY = "openapi-docs-sidebar:" + (workspace || "default");
|
|
1532
1343
|
const SIDEBAR_MIN = 200;
|
|
@@ -2258,7 +2069,7 @@
|
|
|
2258
2069
|
};
|
|
2259
2070
|
};
|
|
2260
2071
|
|
|
2261
|
-
document.title = title
|
|
2072
|
+
document.title = title || "API Documentation";
|
|
2262
2073
|
const brandEl = document.getElementById("brand");
|
|
2263
2074
|
if (brandEl) brandEl.textContent = title;
|
|
2264
2075
|
const specVersion = (spec.info && spec.info.version) || "";
|
|
@@ -2512,7 +2323,7 @@
|
|
|
2512
2323
|
}
|
|
2513
2324
|
return {
|
|
2514
2325
|
id: typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : String(Date.now()),
|
|
2515
|
-
name: (workspace || title || "
|
|
2326
|
+
name: (workspace || title || "API") + " · " + store.activeEnv,
|
|
2516
2327
|
values,
|
|
2517
2328
|
_postman_variable_scope: "environment",
|
|
2518
2329
|
_postman_exported_at: new Date().toISOString(),
|
|
@@ -2685,8 +2496,8 @@
|
|
|
2685
2496
|
return {
|
|
2686
2497
|
info: {
|
|
2687
2498
|
_postman_id: typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : String(Date.now()),
|
|
2688
|
-
name: (openapi.info && openapi.info.title) || workspace || title || "
|
|
2689
|
-
description: (openapi.info && openapi.info.description) || "Exported from
|
|
2499
|
+
name: (openapi.info && openapi.info.title) || workspace || title || "API",
|
|
2500
|
+
description: (openapi.info && openapi.info.description) || "Exported from API docs with named examples",
|
|
2690
2501
|
schema: "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
2691
2502
|
},
|
|
2692
2503
|
item,
|
|
@@ -3582,7 +3393,7 @@
|
|
|
3582
3393
|
body: undefined,
|
|
3583
3394
|
error:
|
|
3584
3395
|
message +
|
|
3585
|
-
"\n\nTip: open docs at the same app port: http://localhost:3000
|
|
3396
|
+
"\n\nTip: open API docs at the same app port: http://localhost:3000" + docsPathSuffix,
|
|
3586
3397
|
};
|
|
3587
3398
|
}
|
|
3588
3399
|
renderMain();
|
|
@@ -3603,6 +3414,7 @@
|
|
|
3603
3414
|
if (version) activeVersion = version;
|
|
3604
3415
|
expandedExampleOps.add(id);
|
|
3605
3416
|
}
|
|
3417
|
+
renderPrefixBar();
|
|
3606
3418
|
renderNav();
|
|
3607
3419
|
renderMain();
|
|
3608
3420
|
history.replaceState(null, "", "#" + encodeURIComponent(id));
|
|
@@ -3665,23 +3477,35 @@
|
|
|
3665
3477
|
}
|
|
3666
3478
|
});
|
|
3667
3479
|
|
|
3668
|
-
const
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3480
|
+
const prefixLabel = (name) => (String(name).startsWith("/") ? name : "/" + name);
|
|
3481
|
+
const renderPrefixBar = () => {
|
|
3482
|
+
const bar = document.getElementById("prefix-bar");
|
|
3483
|
+
if (!bar) return;
|
|
3484
|
+
if (apiVersions.length < 2) {
|
|
3485
|
+
bar.hidden = true;
|
|
3486
|
+
bar.innerHTML = "";
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
bar.hidden = false;
|
|
3490
|
+
bar.innerHTML = apiVersions
|
|
3491
|
+
.map(
|
|
3492
|
+
(name) =>
|
|
3493
|
+
`<button type="button" class="prefix-chip ${name === activeVersion ? "on" : ""}" data-prefix="${escapeAttr(name)}" aria-pressed="${name === activeVersion ? "true" : "false"}">${escapeHtml(prefixLabel(name))}</button>`,
|
|
3494
|
+
)
|
|
3495
|
+
.join("");
|
|
3496
|
+
bar.querySelectorAll(".prefix-chip").forEach((button) => {
|
|
3497
|
+
button.onclick = () => {
|
|
3498
|
+
activeVersion = button.dataset.prefix;
|
|
3676
3499
|
const first = visibleOps()[0];
|
|
3677
3500
|
if (first) select(first.id);
|
|
3678
3501
|
else {
|
|
3502
|
+
renderPrefixBar();
|
|
3679
3503
|
renderNav();
|
|
3680
3504
|
renderMain();
|
|
3681
3505
|
}
|
|
3682
3506
|
};
|
|
3683
|
-
}
|
|
3684
|
-
}
|
|
3507
|
+
});
|
|
3508
|
+
};
|
|
3685
3509
|
|
|
3686
3510
|
const initial = decodeURIComponent(location.hash.replace(/^#/, "")) || ops[0]?.id;
|
|
3687
3511
|
select(ops.some((item) => item.id === initial) ? initial : ops[0]?.id);
|
package/assets/viewer.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="__FAVICON_DATA_URI__" />
|
|
8
8
|
<link rel="apple-touch-icon" href="__FAVICON_DATA_URI__" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
@@ -79,16 +79,29 @@
|
|
|
79
79
|
text-overflow: ellipsis;
|
|
80
80
|
color: var(--obsidian);
|
|
81
81
|
}
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
.prefix-bar {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
gap: 4px;
|
|
86
|
+
margin: 0 0 8px;
|
|
87
|
+
flex: none;
|
|
88
|
+
}
|
|
89
|
+
.prefix-bar[hidden] { display: none; }
|
|
90
|
+
.prefix-chip {
|
|
91
|
+
height: 22px;
|
|
92
|
+
padding: 0 8px;
|
|
93
|
+
border: 0;
|
|
85
94
|
border-radius: 4px;
|
|
86
|
-
background:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
padding: 0 6px;
|
|
95
|
+
background: transparent;
|
|
96
|
+
color: var(--stone);
|
|
97
|
+
font: 500 11px/22px var(--mono);
|
|
90
98
|
cursor: pointer;
|
|
91
99
|
}
|
|
100
|
+
.prefix-chip:hover { color: var(--obsidian); background: var(--inset); }
|
|
101
|
+
.prefix-chip.on {
|
|
102
|
+
background: var(--inset);
|
|
103
|
+
color: var(--obsidian);
|
|
104
|
+
}
|
|
92
105
|
.nav-tools { display: flex; align-items: center; gap: 8px; justify-self: end; }
|
|
93
106
|
.nav-tools .btn {
|
|
94
107
|
height: 28px;
|
|
@@ -1239,7 +1252,6 @@
|
|
|
1239
1252
|
<header class="topnav">
|
|
1240
1253
|
<div class="brand-wrap">
|
|
1241
1254
|
<div class="brand" id="brand">API</div>
|
|
1242
|
-
<select class="ver-select" id="ver-select" aria-label="API version"></select>
|
|
1243
1255
|
</div>
|
|
1244
1256
|
<div class="ep-nav" id="ep-nav">
|
|
1245
1257
|
<span class="ep-name" id="ep-name"></span>
|
|
@@ -1287,6 +1299,7 @@
|
|
|
1287
1299
|
<span class="search-kbd">/</span>
|
|
1288
1300
|
<div class="search-panel" id="search-panel" role="listbox"></div>
|
|
1289
1301
|
</div>
|
|
1302
|
+
<div class="prefix-bar" id="prefix-bar" hidden></div>
|
|
1290
1303
|
<div class="tree-scroll" id="nav"></div>
|
|
1291
1304
|
<div class="nav-foot"><span>Generated by DAxTA</span><span id="nav-version"></span></div>
|
|
1292
1305
|
</aside>
|
|
@@ -1302,7 +1315,7 @@
|
|
|
1302
1315
|
const viewer = spec["x-viewer"] || {};
|
|
1303
1316
|
const workspace = (spec.info && spec.info["x-workspace"]) || viewer.workspace || "";
|
|
1304
1317
|
const defaultBaseUrlFromSpec = String((viewer.baseUrl || (spec.servers && spec.servers[0] && spec.servers[0].url) || "http://localhost:3000")).replace(/\/$/, "");
|
|
1305
|
-
const docsPathSuffix = String(viewer.docsPath || "/docs").replace(/\/$/, "") || "/docs";
|
|
1318
|
+
const docsPathSuffix = String(viewer.docsPath || "/api-docs").replace(/\/$/, "") || "/api-docs";
|
|
1306
1319
|
|
|
1307
1320
|
const inferBaseUrlFromLocation = () => {
|
|
1308
1321
|
if (typeof location === "undefined") return null;
|
|
@@ -1322,9 +1335,9 @@
|
|
|
1322
1335
|
};
|
|
1323
1336
|
|
|
1324
1337
|
const locationBaseUrl = inferBaseUrlFromLocation();
|
|
1325
|
-
// Prefer the URL that is serving the viewer (strip
|
|
1338
|
+
// Prefer the URL that is serving the viewer (strip the docs path), else fall back to spec.
|
|
1326
1339
|
const defaultBaseUrl = locationBaseUrl || defaultBaseUrlFromSpec;
|
|
1327
|
-
const title = (spec.info && spec.info.title) || "API
|
|
1340
|
+
const title = (spec.info && spec.info.title) || "API Documentation";
|
|
1328
1341
|
const STORE_KEY = "openapi-docs-env:" + (workspace || "default");
|
|
1329
1342
|
const SIDEBAR_STORE_KEY = "openapi-docs-sidebar:" + (workspace || "default");
|
|
1330
1343
|
const SIDEBAR_MIN = 200;
|
|
@@ -2056,7 +2069,7 @@
|
|
|
2056
2069
|
};
|
|
2057
2070
|
};
|
|
2058
2071
|
|
|
2059
|
-
document.title = title
|
|
2072
|
+
document.title = title || "API Documentation";
|
|
2060
2073
|
const brandEl = document.getElementById("brand");
|
|
2061
2074
|
if (brandEl) brandEl.textContent = title;
|
|
2062
2075
|
const specVersion = (spec.info && spec.info.version) || "";
|
|
@@ -2310,7 +2323,7 @@
|
|
|
2310
2323
|
}
|
|
2311
2324
|
return {
|
|
2312
2325
|
id: typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : String(Date.now()),
|
|
2313
|
-
name: (workspace || title || "
|
|
2326
|
+
name: (workspace || title || "API") + " · " + store.activeEnv,
|
|
2314
2327
|
values,
|
|
2315
2328
|
_postman_variable_scope: "environment",
|
|
2316
2329
|
_postman_exported_at: new Date().toISOString(),
|
|
@@ -2483,8 +2496,8 @@
|
|
|
2483
2496
|
return {
|
|
2484
2497
|
info: {
|
|
2485
2498
|
_postman_id: typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : String(Date.now()),
|
|
2486
|
-
name: (openapi.info && openapi.info.title) || workspace || title || "
|
|
2487
|
-
description: (openapi.info && openapi.info.description) || "Exported from
|
|
2499
|
+
name: (openapi.info && openapi.info.title) || workspace || title || "API",
|
|
2500
|
+
description: (openapi.info && openapi.info.description) || "Exported from API docs with named examples",
|
|
2488
2501
|
schema: "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
2489
2502
|
},
|
|
2490
2503
|
item,
|
|
@@ -3380,7 +3393,7 @@
|
|
|
3380
3393
|
body: undefined,
|
|
3381
3394
|
error:
|
|
3382
3395
|
message +
|
|
3383
|
-
"\n\nTip: open docs at the same app port: http://localhost:3000
|
|
3396
|
+
"\n\nTip: open API docs at the same app port: http://localhost:3000" + docsPathSuffix,
|
|
3384
3397
|
};
|
|
3385
3398
|
}
|
|
3386
3399
|
renderMain();
|
|
@@ -3401,6 +3414,7 @@
|
|
|
3401
3414
|
if (version) activeVersion = version;
|
|
3402
3415
|
expandedExampleOps.add(id);
|
|
3403
3416
|
}
|
|
3417
|
+
renderPrefixBar();
|
|
3404
3418
|
renderNav();
|
|
3405
3419
|
renderMain();
|
|
3406
3420
|
history.replaceState(null, "", "#" + encodeURIComponent(id));
|
|
@@ -3463,23 +3477,35 @@
|
|
|
3463
3477
|
}
|
|
3464
3478
|
});
|
|
3465
3479
|
|
|
3466
|
-
const
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3480
|
+
const prefixLabel = (name) => (String(name).startsWith("/") ? name : "/" + name);
|
|
3481
|
+
const renderPrefixBar = () => {
|
|
3482
|
+
const bar = document.getElementById("prefix-bar");
|
|
3483
|
+
if (!bar) return;
|
|
3484
|
+
if (apiVersions.length < 2) {
|
|
3485
|
+
bar.hidden = true;
|
|
3486
|
+
bar.innerHTML = "";
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
bar.hidden = false;
|
|
3490
|
+
bar.innerHTML = apiVersions
|
|
3491
|
+
.map(
|
|
3492
|
+
(name) =>
|
|
3493
|
+
`<button type="button" class="prefix-chip ${name === activeVersion ? "on" : ""}" data-prefix="${escapeAttr(name)}" aria-pressed="${name === activeVersion ? "true" : "false"}">${escapeHtml(prefixLabel(name))}</button>`,
|
|
3494
|
+
)
|
|
3495
|
+
.join("");
|
|
3496
|
+
bar.querySelectorAll(".prefix-chip").forEach((button) => {
|
|
3497
|
+
button.onclick = () => {
|
|
3498
|
+
activeVersion = button.dataset.prefix;
|
|
3474
3499
|
const first = visibleOps()[0];
|
|
3475
3500
|
if (first) select(first.id);
|
|
3476
3501
|
else {
|
|
3502
|
+
renderPrefixBar();
|
|
3477
3503
|
renderNav();
|
|
3478
3504
|
renderMain();
|
|
3479
3505
|
}
|
|
3480
3506
|
};
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3507
|
+
});
|
|
3508
|
+
};
|
|
3483
3509
|
|
|
3484
3510
|
const initial = decodeURIComponent(location.hash.replace(/^#/, "")) || ops[0]?.id;
|
|
3485
3511
|
select(ops.some((item) => item.id === initial) ? initial : ops[0]?.id);
|