@digi-frontend/dgate-api-documentation 4.1.8 → 4.2.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/dist/index.cjs +100 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +100 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -711,7 +711,8 @@ const OverflowTooltip = ({ title, children, className, style, placement }) => {
|
|
|
711
711
|
const checkOverflow = (0, react.useCallback)(() => {
|
|
712
712
|
const el = ref.current;
|
|
713
713
|
if (!el) return;
|
|
714
|
-
|
|
714
|
+
const target = el.firstElementChild ?? el;
|
|
715
|
+
setIsOverflowing(target.scrollWidth > target.clientWidth);
|
|
715
716
|
}, []);
|
|
716
717
|
(0, react.useEffect)(() => {
|
|
717
718
|
checkOverflow();
|
|
@@ -1301,7 +1302,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1301
1302
|
borderRadius: token.borderRadiusSM,
|
|
1302
1303
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1303
1304
|
minWidth: "6.25rem",
|
|
1304
|
-
maxWidth: "
|
|
1305
|
+
maxWidth: "100%",
|
|
1305
1306
|
svg: { path: { fill: "#4D75D9" } }
|
|
1306
1307
|
},
|
|
1307
1308
|
[scope("list-title")]: {
|
|
@@ -1314,6 +1315,9 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1314
1315
|
fontFamily: token.fontFamily,
|
|
1315
1316
|
cursor: "pointer",
|
|
1316
1317
|
transition: "color 0.2s ease-in",
|
|
1318
|
+
overflow: "hidden",
|
|
1319
|
+
textOverflow: "ellipsis",
|
|
1320
|
+
whiteSpace: "nowrap",
|
|
1317
1321
|
"&:hover": {
|
|
1318
1322
|
color: `${token.colorPrimary} !important`,
|
|
1319
1323
|
textDecoration: "underline"
|
|
@@ -1401,6 +1405,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1401
1405
|
className: cx("list-container"),
|
|
1402
1406
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
|
|
1403
1407
|
gap: token.marginSM,
|
|
1408
|
+
style: { minWidth: 0 },
|
|
1404
1409
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api.method }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
|
|
1405
1410
|
className: cx("list-title"),
|
|
1406
1411
|
level: 4,
|
|
@@ -2209,6 +2214,39 @@ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPag
|
|
|
2209
2214
|
}));
|
|
2210
2215
|
};
|
|
2211
2216
|
//#endregion
|
|
2217
|
+
//#region src/assets/icons/md_left_icon.tsx
|
|
2218
|
+
const MdLeftIcon = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
2219
|
+
width: "18",
|
|
2220
|
+
height: "18",
|
|
2221
|
+
viewBox: "0 0 18 18",
|
|
2222
|
+
fill: "none",
|
|
2223
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2224
|
+
stroke: "rgba(0,0,0,0.45)",
|
|
2225
|
+
...props,
|
|
2226
|
+
children: [
|
|
2227
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2228
|
+
d: "M8.25 1.5H6.75C3 1.5 1.5 3 1.5 6.75V11.25C1.5 15 3 16.5 6.75 16.5H11.25C15 16.5 16.5 15 16.5 11.25V9.75",
|
|
2229
|
+
strokeWidth: "1.5",
|
|
2230
|
+
strokeLinecap: "round",
|
|
2231
|
+
strokeLinejoin: "round"
|
|
2232
|
+
}),
|
|
2233
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2234
|
+
d: "M12.0299 2.26592L6.11991 8.17592C5.89491 8.40092 5.66991 8.84342 5.62491 9.16592L5.30241 11.4234C5.18241 12.2409 5.75991 12.8109 6.57741 12.6984L8.83491 12.3759C9.14991 12.3309 9.59241 12.1059 9.82491 11.8809L15.7349 5.97092C16.7549 4.95092 17.2349 3.76592 15.7349 2.26592C14.2349 0.765922 13.0499 1.24592 12.0299 2.26592Z",
|
|
2235
|
+
strokeWidth: "1.5",
|
|
2236
|
+
strokeMiterlimit: "10",
|
|
2237
|
+
strokeLinecap: "round",
|
|
2238
|
+
strokeLinejoin: "round"
|
|
2239
|
+
}),
|
|
2240
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2241
|
+
d: "M11.1826 3.11328C11.6851 4.90578 13.0876 6.30828 14.8876 6.81828",
|
|
2242
|
+
strokeWidth: "1.5",
|
|
2243
|
+
strokeMiterlimit: "10",
|
|
2244
|
+
strokeLinecap: "round",
|
|
2245
|
+
strokeLinejoin: "round"
|
|
2246
|
+
})
|
|
2247
|
+
]
|
|
2248
|
+
});
|
|
2249
|
+
//#endregion
|
|
2212
2250
|
//#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
|
|
2213
2251
|
const { useBreakpoint: useBreakpoint$4 } = antd.Grid;
|
|
2214
2252
|
const { Title: Title$6 } = antd.Typography;
|
|
@@ -2268,10 +2306,11 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2268
2306
|
background: token.colorBgLayout,
|
|
2269
2307
|
padding: "4px 4px",
|
|
2270
2308
|
borderRadius: token.borderRadius,
|
|
2271
|
-
gap:
|
|
2309
|
+
gap: 4
|
|
2272
2310
|
},
|
|
2273
2311
|
[scope("switcher-item")]: {
|
|
2274
2312
|
display: "flex",
|
|
2313
|
+
justifyContent: "center",
|
|
2275
2314
|
alignItems: "center",
|
|
2276
2315
|
gap: 8,
|
|
2277
2316
|
padding: "8px 12px",
|
|
@@ -2326,11 +2365,13 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2326
2365
|
title: apiName,
|
|
2327
2366
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Title$6, {
|
|
2328
2367
|
level: 3,
|
|
2329
|
-
ellipsis: true,
|
|
2330
2368
|
style: {
|
|
2331
2369
|
margin: 0,
|
|
2332
2370
|
fontWeight: 600,
|
|
2333
|
-
color: token.colorTextHeading
|
|
2371
|
+
color: token.colorTextHeading,
|
|
2372
|
+
whiteSpace: "nowrap",
|
|
2373
|
+
overflow: "hidden",
|
|
2374
|
+
textOverflow: "ellipsis"
|
|
2334
2375
|
},
|
|
2335
2376
|
children: apiName
|
|
2336
2377
|
})
|
|
@@ -2385,7 +2426,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2385
2426
|
onClick: () => onModeChange("edit"),
|
|
2386
2427
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2387
2428
|
className: cx("switcher-icon"),
|
|
2388
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2429
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MdLeftIcon, {})
|
|
2389
2430
|
}), "Edit"]
|
|
2390
2431
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2391
2432
|
className: cx("switcher-item", mode === "view" ? "switcher-item-active" : ""),
|
|
@@ -2723,42 +2764,42 @@ function useDebounce(value, delay = 500) {
|
|
|
2723
2764
|
//#region src/view/components/ApiPage/components/AddParameterDrawer.tsx
|
|
2724
2765
|
const PARAM_IN_OPTIONS = [
|
|
2725
2766
|
{
|
|
2726
|
-
label: "
|
|
2767
|
+
label: "Query",
|
|
2727
2768
|
value: "query"
|
|
2728
2769
|
},
|
|
2729
2770
|
{
|
|
2730
|
-
label: "
|
|
2771
|
+
label: "Header",
|
|
2731
2772
|
value: "header"
|
|
2732
2773
|
},
|
|
2733
2774
|
{
|
|
2734
|
-
label: "
|
|
2775
|
+
label: "Path",
|
|
2735
2776
|
value: "path"
|
|
2736
2777
|
}
|
|
2737
2778
|
];
|
|
2738
2779
|
const RESPONSE_PARAM_IN_OPTIONS = PARAM_IN_OPTIONS.filter((o) => o.value === "header");
|
|
2739
2780
|
const PARAM_TYPE_OPTIONS = [
|
|
2740
2781
|
{
|
|
2741
|
-
label: "
|
|
2782
|
+
label: "String",
|
|
2742
2783
|
value: "string"
|
|
2743
2784
|
},
|
|
2744
2785
|
{
|
|
2745
|
-
label: "
|
|
2786
|
+
label: "Number",
|
|
2746
2787
|
value: "number"
|
|
2747
2788
|
},
|
|
2748
2789
|
{
|
|
2749
|
-
label: "
|
|
2790
|
+
label: "Integer",
|
|
2750
2791
|
value: "integer"
|
|
2751
2792
|
},
|
|
2752
2793
|
{
|
|
2753
|
-
label: "
|
|
2794
|
+
label: "Boolean",
|
|
2754
2795
|
value: "boolean"
|
|
2755
2796
|
},
|
|
2756
2797
|
{
|
|
2757
|
-
label: "
|
|
2798
|
+
label: "Array",
|
|
2758
2799
|
value: "array"
|
|
2759
2800
|
},
|
|
2760
2801
|
{
|
|
2761
|
-
label: "
|
|
2802
|
+
label: "Object",
|
|
2762
2803
|
value: "object"
|
|
2763
2804
|
}
|
|
2764
2805
|
];
|
|
@@ -3465,27 +3506,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3465
3506
|
}));
|
|
3466
3507
|
});
|
|
3467
3508
|
}, [openResponsePanels, responseBodySchemas]);
|
|
3468
|
-
(0, react$1.useEffect)(() => {
|
|
3469
|
-
if (!openResponsePanels.size) return;
|
|
3470
|
-
openResponsePanels.forEach((epId) => {
|
|
3471
|
-
const code = selectedStatusCodes[epId];
|
|
3472
|
-
if (!code) return;
|
|
3473
|
-
const ep = Object.values(endpointsByTag).flat().find((e) => e.id === epId);
|
|
3474
|
-
if (!ep?.responses?.[code]?.content) return;
|
|
3475
|
-
const content = ep.responses[code].content;
|
|
3476
|
-
const schema = Object.values(content)[0]?.schema;
|
|
3477
|
-
if (!schema) return;
|
|
3478
|
-
const json = JSON.stringify(schema, null, 2);
|
|
3479
|
-
setEditableResponseContent((prev) => ({
|
|
3480
|
-
...prev,
|
|
3481
|
-
[epId]: json
|
|
3482
|
-
}));
|
|
3483
|
-
});
|
|
3484
|
-
}, [
|
|
3485
|
-
selectedStatusCodes,
|
|
3486
|
-
openResponsePanels,
|
|
3487
|
-
endpointsByTag
|
|
3488
|
-
]);
|
|
3489
3509
|
const handleValidate = (content) => {
|
|
3490
3510
|
try {
|
|
3491
3511
|
JSON.parse(content);
|
|
@@ -4069,7 +4089,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4069
4089
|
alignItems: "center",
|
|
4070
4090
|
justifyContent: "center",
|
|
4071
4091
|
width: "100%",
|
|
4072
|
-
flex: 1,
|
|
4073
4092
|
minHeight: 0,
|
|
4074
4093
|
"& .ant-empty": {
|
|
4075
4094
|
margin: 0,
|
|
@@ -4516,7 +4535,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4516
4535
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4517
4536
|
className: cx("param-detail-label"),
|
|
4518
4537
|
children: "Parameter Name"
|
|
4519
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4538
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowTooltip, {
|
|
4520
4539
|
title: param.name,
|
|
4521
4540
|
placement: "bottom",
|
|
4522
4541
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -4598,7 +4617,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4598
4617
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4599
4618
|
className: cx("param-detail-label"),
|
|
4600
4619
|
children: "Parameter Name"
|
|
4601
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4620
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowTooltip, {
|
|
4602
4621
|
title: param.name,
|
|
4603
4622
|
placement: "bottom",
|
|
4604
4623
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -4671,13 +4690,11 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4671
4690
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4672
4691
|
className: cx("param-detail-label"),
|
|
4673
4692
|
children: "Description"
|
|
4674
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4693
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowTooltip, {
|
|
4675
4694
|
title: param.description || "—",
|
|
4676
4695
|
placement: "bottom",
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
children: param.description || "—"
|
|
4680
|
-
})
|
|
4696
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
4697
|
+
children: param.description || "—"
|
|
4681
4698
|
})]
|
|
4682
4699
|
})
|
|
4683
4700
|
]
|
|
@@ -5087,7 +5104,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5087
5104
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5088
5105
|
className: cx("param-detail-label"),
|
|
5089
5106
|
children: "Parameter Name"
|
|
5090
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5107
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowTooltip, {
|
|
5091
5108
|
title: param.name,
|
|
5092
5109
|
placement: "bottom",
|
|
5093
5110
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -5160,13 +5177,11 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5160
5177
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5161
5178
|
className: cx("param-detail-label"),
|
|
5162
5179
|
children: "Description"
|
|
5163
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5180
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowTooltip, {
|
|
5164
5181
|
title: param.description || "—",
|
|
5165
5182
|
placement: "bottom",
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
children: param.description || "—"
|
|
5169
|
-
})
|
|
5183
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
5184
|
+
children: param.description || "—"
|
|
5170
5185
|
})]
|
|
5171
5186
|
})
|
|
5172
5187
|
]
|
|
@@ -5581,8 +5596,11 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5581
5596
|
if (!schema) return null;
|
|
5582
5597
|
let displayData;
|
|
5583
5598
|
if (contentEntry.example !== void 0) displayData = contentEntry.example;
|
|
5584
|
-
else if (contentEntry.examples !== void 0)
|
|
5585
|
-
|
|
5599
|
+
else if (contentEntry.examples !== void 0) {
|
|
5600
|
+
const firstKey = Object.keys(contentEntry.examples)[0];
|
|
5601
|
+
const firstExample = contentEntry.examples[firstKey];
|
|
5602
|
+
displayData = firstExample?.value ?? firstExample;
|
|
5603
|
+
} else if (hasAnyExample(schema)) displayData = generateExampleFromSchema(schema);
|
|
5586
5604
|
else displayData = schema;
|
|
5587
5605
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5588
5606
|
className: cx("code-panel"),
|
|
@@ -7277,7 +7295,6 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag,
|
|
|
7277
7295
|
alignItems: "center",
|
|
7278
7296
|
position: "relative",
|
|
7279
7297
|
paddingTop: 20,
|
|
7280
|
-
paddingBottom: 8,
|
|
7281
7298
|
paddingLeft: 24,
|
|
7282
7299
|
paddingRight: 24,
|
|
7283
7300
|
width: "100%"
|
|
@@ -9056,8 +9073,11 @@ function CodeboxSidebar$1() {
|
|
|
9056
9073
|
const contentEntry = responseObj?.content ? Object.values(responseObj.content)[0] : void 0;
|
|
9057
9074
|
let displayData;
|
|
9058
9075
|
if (contentEntry?.example !== void 0) displayData = contentEntry.example;
|
|
9059
|
-
else if (contentEntry?.examples !== void 0)
|
|
9060
|
-
|
|
9076
|
+
else if (contentEntry?.examples !== void 0) {
|
|
9077
|
+
const firstKey = Object.keys(contentEntry.examples)[0];
|
|
9078
|
+
const firstExample = contentEntry.examples[firstKey];
|
|
9079
|
+
displayData = firstExample?.value ?? firstExample;
|
|
9080
|
+
} else if (contentEntry?.schema && hasAnyExample(contentEntry.schema)) displayData = generateExampleFromSchema(contentEntry.schema);
|
|
9061
9081
|
else if (contentEntry?.schema) displayData = contentEntry.schema;
|
|
9062
9082
|
else displayData = responseObj;
|
|
9063
9083
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox$1, { code: JSON.stringify(displayData, null, 2) || "" });
|
|
@@ -9115,7 +9135,15 @@ const transformOpenApiToDocs = (api) => {
|
|
|
9115
9135
|
};
|
|
9116
9136
|
if (entry.requestBody?.content) {
|
|
9117
9137
|
const resolvedContent = {};
|
|
9118
|
-
for (const [contentType, contentValue] of Object.entries(entry.requestBody.content))
|
|
9138
|
+
for (const [contentType, contentValue] of Object.entries(entry.requestBody.content)) {
|
|
9139
|
+
const resolvedSchema = resolveSchema(contentValue.schema, api.components) ?? contentValue.schema;
|
|
9140
|
+
const resolvedExample = contentValue.example !== void 0 ? contentValue.example : resolvedSchema.example;
|
|
9141
|
+
resolvedContent[contentType] = {
|
|
9142
|
+
schema: resolvedSchema,
|
|
9143
|
+
...resolvedExample !== void 0 && { example: resolvedExample },
|
|
9144
|
+
...contentValue.examples !== void 0 && { examples: contentValue.examples }
|
|
9145
|
+
};
|
|
9146
|
+
}
|
|
9119
9147
|
entry.requestBody = {
|
|
9120
9148
|
...entry.requestBody,
|
|
9121
9149
|
content: resolvedContent
|
|
@@ -9125,7 +9153,15 @@ const transformOpenApiToDocs = (api) => {
|
|
|
9125
9153
|
const resolvedResponses = {};
|
|
9126
9154
|
for (const [code, responseValue] of Object.entries(entry.responses)) if (responseValue.content) {
|
|
9127
9155
|
const resolvedContent = {};
|
|
9128
|
-
for (const [contentType, contentValue] of Object.entries(responseValue.content))
|
|
9156
|
+
for (const [contentType, contentValue] of Object.entries(responseValue.content)) {
|
|
9157
|
+
const resolvedSchema = resolveSchema(contentValue.schema, api.components) ?? contentValue.schema;
|
|
9158
|
+
const resolvedExample = contentValue.example !== void 0 ? contentValue.example : resolvedSchema.example;
|
|
9159
|
+
resolvedContent[contentType] = {
|
|
9160
|
+
schema: resolvedSchema,
|
|
9161
|
+
...resolvedExample !== void 0 && { example: resolvedExample },
|
|
9162
|
+
...contentValue.examples !== void 0 && { examples: contentValue.examples }
|
|
9163
|
+
};
|
|
9164
|
+
}
|
|
9129
9165
|
resolvedResponses[code] = {
|
|
9130
9166
|
...responseValue,
|
|
9131
9167
|
content: resolvedContent
|
|
@@ -9308,7 +9344,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9308
9344
|
alignItems: "center",
|
|
9309
9345
|
position: "relative",
|
|
9310
9346
|
paddingTop: 20,
|
|
9311
|
-
paddingBottom: 8,
|
|
9312
9347
|
paddingLeft: 24,
|
|
9313
9348
|
paddingRight: 24,
|
|
9314
9349
|
width: "100%"
|
|
@@ -9485,7 +9520,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9485
9520
|
Object.entries(methods).forEach(([method, operation]) => {
|
|
9486
9521
|
const responses = operation.responses;
|
|
9487
9522
|
if (!responses) return;
|
|
9488
|
-
const schema = responses["200" in responses ? "200" : Object.keys(responses)[0]]?.content?.["application/json"]?.
|
|
9523
|
+
const schema = responses["200" in responses ? "200" : Object.keys(responses)[0]]?.content?.["application/json"]?.example;
|
|
9489
9524
|
const epId = pathMethodToId[`${path}||${method}`];
|
|
9490
9525
|
if (epId && schema) result[epId] = schema;
|
|
9491
9526
|
});
|
|
@@ -9775,7 +9810,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9775
9810
|
const statusCode = "200" in responses ? "200" : Object.keys(responses)[0];
|
|
9776
9811
|
if (!responses[statusCode]) return;
|
|
9777
9812
|
if (!responses[statusCode].content) responses[statusCode].content = {};
|
|
9778
|
-
responses[statusCode].content["application/json"] = { schema };
|
|
9813
|
+
responses[statusCode].content["application/json"] = { example: schema };
|
|
9779
9814
|
});
|
|
9780
9815
|
try {
|
|
9781
9816
|
await onSave?.(cloned);
|
|
@@ -10789,8 +10824,11 @@ function CodeboxSidebar() {
|
|
|
10789
10824
|
const contentEntry = responseObj?.content ? Object.values(responseObj.content)[0] : void 0;
|
|
10790
10825
|
let displayData;
|
|
10791
10826
|
if (contentEntry?.example !== void 0) displayData = contentEntry.example;
|
|
10792
|
-
else if (contentEntry?.examples !== void 0)
|
|
10793
|
-
|
|
10827
|
+
else if (contentEntry?.examples !== void 0) {
|
|
10828
|
+
const firstKey = Object.keys(contentEntry.examples)[0];
|
|
10829
|
+
const firstExample = contentEntry.examples[firstKey];
|
|
10830
|
+
displayData = firstExample?.value ?? firstExample;
|
|
10831
|
+
} else if (contentEntry?.schema && hasAnyExample(contentEntry.schema)) displayData = generateExampleFromSchema(contentEntry.schema);
|
|
10794
10832
|
else if (contentEntry?.schema) displayData = contentEntry.schema;
|
|
10795
10833
|
else displayData = responseObj;
|
|
10796
10834
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox, { code: JSON.stringify(displayData, null, 2) || "" });
|