zudoku 0.91.0 → 0.92.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/cli/cli.js +2 -0
- package/dist/cli/worker.js +1 -0
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +8 -0
- package/dist/declarations/lib/plugins/openapi/interfaces.d.ts +1 -0
- package/dist/declarations/lib/plugins/openapi/util/shouldShowRequestBox.d.ts +1 -0
- package/dist/flat-config.d.ts +1 -0
- package/docs/configuration/api-reference.md +15 -2
- package/docs/openapi-extensions/x-zudoku-request-box-enabled.md +47 -0
- package/package.json +1 -1
- package/src/config/validators/ZudokuConfig.ts +1 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +85 -74
- package/src/lib/plugins/openapi/interfaces.ts +1 -0
- package/src/lib/plugins/openapi/util/shouldShowRequestBox.ts +18 -0
- package/src/vite/plugin-api.ts +1 -0
package/dist/cli/cli.js
CHANGED
|
@@ -3402,6 +3402,7 @@ var ApiOptionsSchema = z7.object({
|
|
|
3402
3402
|
supportedLanguages: z7.array(LanguageOption),
|
|
3403
3403
|
disablePlayground: z7.boolean(),
|
|
3404
3404
|
disableSidecar: z7.boolean(),
|
|
3405
|
+
disableRequestBox: z7.boolean(),
|
|
3405
3406
|
showVersionSelect: z7.enum(["always", "if-available", "hide"]),
|
|
3406
3407
|
expandAllTags: z7.boolean(),
|
|
3407
3408
|
showInfoPage: z7.boolean(),
|
|
@@ -6816,6 +6817,7 @@ var generateDefaultApiOptionsCode = () => [
|
|
|
6816
6817
|
` supportedLanguages: config.defaults?.apis?.supportedLanguages,`,
|
|
6817
6818
|
` disablePlayground: config.defaults?.apis?.disablePlayground,`,
|
|
6818
6819
|
` disableSidecar: config.defaults?.apis?.disableSidecar,`,
|
|
6820
|
+
` disableRequestBox: config.defaults?.apis?.disableRequestBox,`,
|
|
6819
6821
|
` disableSecurity: config.defaults?.apis?.disableSecurity ?? true,`,
|
|
6820
6822
|
` disableMcpAuthInstructions: config.defaults?.apis?.disableMcpAuthInstructions,`,
|
|
6821
6823
|
` showVersionSelect: config.defaults?.apis?.showVersionSelect ?? "if-available",`,
|
package/dist/cli/worker.js
CHANGED
|
@@ -2514,6 +2514,7 @@ var ApiOptionsSchema = z4.object({
|
|
|
2514
2514
|
supportedLanguages: z4.array(LanguageOption),
|
|
2515
2515
|
disablePlayground: z4.boolean(),
|
|
2516
2516
|
disableSidecar: z4.boolean(),
|
|
2517
|
+
disableRequestBox: z4.boolean(),
|
|
2517
2518
|
showVersionSelect: z4.enum(["always", "if-available", "hide"]),
|
|
2518
2519
|
expandAllTags: z4.boolean(),
|
|
2519
2520
|
showInfoPage: z4.boolean(),
|
|
@@ -49,6 +49,7 @@ declare const ApiOptionsSchema: z.ZodObject<{
|
|
|
49
49
|
}, z.core.$strip>>>;
|
|
50
50
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
51
51
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
52
53
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
53
54
|
always: "always";
|
|
54
55
|
hide: "hide";
|
|
@@ -7741,6 +7742,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7741
7742
|
}, z.core.$strip>>>;
|
|
7742
7743
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7743
7744
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7745
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7744
7746
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7745
7747
|
always: "always";
|
|
7746
7748
|
hide: "hide";
|
|
@@ -7778,6 +7780,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7778
7780
|
}, z.core.$strip>>>;
|
|
7779
7781
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7780
7782
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7783
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7781
7784
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7782
7785
|
always: "always";
|
|
7783
7786
|
hide: "hide";
|
|
@@ -7819,6 +7822,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7819
7822
|
}, z.core.$strip>>>;
|
|
7820
7823
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7821
7824
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7825
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7822
7826
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7823
7827
|
always: "always";
|
|
7824
7828
|
hide: "hide";
|
|
@@ -7852,6 +7856,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7852
7856
|
}, z.core.$strip>>>;
|
|
7853
7857
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7854
7858
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7859
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7855
7860
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7856
7861
|
always: "always";
|
|
7857
7862
|
hide: "hide";
|
|
@@ -7889,6 +7894,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7889
7894
|
}, z.core.$strip>>>;
|
|
7890
7895
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7891
7896
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7897
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7892
7898
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7893
7899
|
always: "always";
|
|
7894
7900
|
hide: "hide";
|
|
@@ -7930,6 +7936,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7930
7936
|
}, z.core.$strip>>>;
|
|
7931
7937
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
7932
7938
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
7939
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
7933
7940
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
7934
7941
|
always: "always";
|
|
7935
7942
|
hide: "hide";
|
|
@@ -8032,6 +8039,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
8032
8039
|
}, z.core.$strip>>>;
|
|
8033
8040
|
disablePlayground: z.ZodOptional<z.ZodBoolean>;
|
|
8034
8041
|
disableSidecar: z.ZodOptional<z.ZodBoolean>;
|
|
8042
|
+
disableRequestBox: z.ZodOptional<z.ZodBoolean>;
|
|
8035
8043
|
showVersionSelect: z.ZodOptional<z.ZodEnum<{
|
|
8036
8044
|
always: "always";
|
|
8037
8045
|
hide: "hide";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldShowRequestBox: (extensions: Record<string, unknown> | null | undefined, disableRequestBox: boolean | undefined) => boolean;
|
package/dist/flat-config.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ const config = {
|
|
|
251
251
|
],
|
|
252
252
|
disablePlayground: false, // Disable the interactive API playground
|
|
253
253
|
disableSidecar: false, // Disable the sidecar completely
|
|
254
|
+
disableRequestBox: false, // Hide the request box at the top of the sidecar
|
|
254
255
|
disableSecurity: true, // Disable security scheme display and playground auth (default)
|
|
255
256
|
disableMcpAuthInstructions: false, // Hide auth steps in the MCP server card
|
|
256
257
|
showVersionSelect: "if-available", // Control version selector visibility
|
|
@@ -272,6 +273,11 @@ Available options:
|
|
|
272
273
|
identifier) and `label` (display name)
|
|
273
274
|
- `disablePlayground`: Disable the interactive API playground globally
|
|
274
275
|
- `disableSidecar`: Disable the sidecar panel completely
|
|
276
|
+
- `disableRequestBox`: Hide the request box at the top of the sidecar. The box holds the method and
|
|
277
|
+
path, the generated code snippet with its language selector, the auth selector and the button that
|
|
278
|
+
opens the playground, so hiding it also removes the way to open the playground. The request body
|
|
279
|
+
and response examples below it are still shown. Operations can override this with
|
|
280
|
+
[`x-zudoku-request-box-enabled`](../openapi-extensions/x-zudoku-request-box-enabled)
|
|
275
281
|
- `disableSecurity`: Disable OpenAPI security scheme display (auth badges on operations, security
|
|
276
282
|
schemes section on the info page, and the Authorize dialog in the playground). Disabled by default
|
|
277
283
|
(`true`). Set to `false` to enable security scheme support
|
|
@@ -310,6 +316,7 @@ const config = {
|
|
|
310
316
|
examplesLanguage: "shell", // Default language for code examples
|
|
311
317
|
disablePlayground: false, // Disable the interactive API playground
|
|
312
318
|
disableSidecar: false, // Disable the sidecar completely
|
|
319
|
+
disableRequestBox: false, // Hide the request box at the top of the sidecar
|
|
313
320
|
disableSecurity: true, // Disable security scheme display and playground auth (default)
|
|
314
321
|
disableMcpAuthInstructions: false, // Hide auth steps in the MCP server card
|
|
315
322
|
showVersionSelect: "if-available", // Control version selector visibility
|
|
@@ -399,9 +406,14 @@ different levels of your API documentation.
|
|
|
399
406
|
### Operations
|
|
400
407
|
|
|
401
408
|
- `x-zudoku-playground-enabled`: Control playground visibility for an operation (default: `true`)
|
|
409
|
+
- `x-zudoku-request-box-enabled`: Control request box visibility in the sidecar for an operation
|
|
410
|
+
(default: `true`). See
|
|
411
|
+
[`x-zudoku-request-box-enabled`](../openapi-extensions/x-zudoku-request-box-enabled)
|
|
402
412
|
- `x-internal`: Hide an operation from the documentation. Also works on path items and parameters.
|
|
403
413
|
See [`x-internal`](../openapi-extensions/x-internal)
|
|
404
|
-
- `x-explorer-enabled`: Alias for `x-zudoku-playground-enabled` for compatibility
|
|
414
|
+
- `x-explorer-enabled`: Alias for `x-zudoku-playground-enabled` for compatibility
|
|
415
|
+
|
|
416
|
+
Example:
|
|
405
417
|
|
|
406
418
|
```json
|
|
407
419
|
{
|
|
@@ -409,7 +421,8 @@ different levels of your API documentation.
|
|
|
409
421
|
"/users": {
|
|
410
422
|
"get": {
|
|
411
423
|
"summary": "Get users",
|
|
412
|
-
"x-zudoku-playground-enabled": false // Disable playground for this operation
|
|
424
|
+
"x-zudoku-playground-enabled": false, // Disable playground for this operation
|
|
425
|
+
"x-zudoku-request-box-enabled": false // Hide the sidecar request box for this operation
|
|
413
426
|
}
|
|
414
427
|
}
|
|
415
428
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: x-zudoku-request-box-enabled
|
|
3
|
+
sidebar_icon: square-code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use `x-zudoku-request-box-enabled` to show or hide the request box at the top of an operation's
|
|
7
|
+
sidecar for a specific operation. By default, the request box is shown for all operations unless
|
|
8
|
+
globally disabled via the [`disableRequestBox`](/docs/configuration/api-reference) option.
|
|
9
|
+
|
|
10
|
+
The request box holds the method and path, the generated code snippet (or your
|
|
11
|
+
[`x-code-samples`](./x-code-samples)) with its language selector, the auth selector and the button
|
|
12
|
+
that opens the playground. Hiding it also removes the way to open the playground for that operation.
|
|
13
|
+
The request body and response examples below it are still shown.
|
|
14
|
+
|
|
15
|
+
## Location
|
|
16
|
+
|
|
17
|
+
The extension is added at the **Operation Object** level.
|
|
18
|
+
|
|
19
|
+
| Option | Type | Description |
|
|
20
|
+
| ------------------------------ | --------- | ------------------------------------------------ |
|
|
21
|
+
| `x-zudoku-request-box-enabled` | `boolean` | Show (`true`) or hide (`false`) the request box. |
|
|
22
|
+
|
|
23
|
+
If the extension is not set, the request box visibility falls back to the global `disableRequestBox`
|
|
24
|
+
configuration.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
paths:
|
|
30
|
+
/users:
|
|
31
|
+
get:
|
|
32
|
+
summary: List users
|
|
33
|
+
x-zudoku-request-box-enabled: true
|
|
34
|
+
responses:
|
|
35
|
+
"200":
|
|
36
|
+
description: Successful response
|
|
37
|
+
/webhooks/trigger:
|
|
38
|
+
post:
|
|
39
|
+
summary: Trigger webhook
|
|
40
|
+
x-zudoku-request-box-enabled: false
|
|
41
|
+
responses:
|
|
42
|
+
"200":
|
|
43
|
+
description: Accepted
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
In this example, `List users` shows the request box while `Trigger webhook` hides it regardless of
|
|
47
|
+
the global setting.
|
package/package.json
CHANGED
|
@@ -93,6 +93,7 @@ const ApiOptionsSchema = z
|
|
|
93
93
|
supportedLanguages: z.array(LanguageOption),
|
|
94
94
|
disablePlayground: z.boolean(),
|
|
95
95
|
disableSidecar: z.boolean(),
|
|
96
|
+
disableRequestBox: z.boolean(),
|
|
96
97
|
showVersionSelect: z.enum(["always", "if-available", "hide"]),
|
|
97
98
|
expandAllTags: z.boolean(),
|
|
98
99
|
showInfoPage: z.boolean(),
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
34
34
|
import { getGraphQLEndpoint } from "./util/graphqlEndpoint.js";
|
|
35
35
|
import { methodForColor } from "./util/methodToColor.js";
|
|
36
|
+
import { shouldShowRequestBox } from "./util/shouldShowRequestBox.js";
|
|
36
37
|
import { useResolvedAuth } from "./util/useResolvedAuth.js";
|
|
37
38
|
|
|
38
39
|
export const GetServerQuery = graphql(/* GraphQL */ `
|
|
@@ -221,7 +222,14 @@ export const Sidecar = ({
|
|
|
221
222
|
const graphQLEndpoint = getGraphQLEndpoint(operation);
|
|
222
223
|
const isGraphQLEndpoint = graphQLEndpoint !== undefined;
|
|
223
224
|
|
|
225
|
+
const showRequestBox = shouldShowRequestBox(
|
|
226
|
+
operation.extensions,
|
|
227
|
+
options?.disableRequestBox,
|
|
228
|
+
);
|
|
229
|
+
|
|
224
230
|
const httpSnippetCode = useMemo<string | undefined>(() => {
|
|
231
|
+
if (!showRequestBox) return;
|
|
232
|
+
|
|
225
233
|
if (codeSamples && !hasResolvedAuth) {
|
|
226
234
|
const match = codeSamples.find((s) => s.lang === selectedLang);
|
|
227
235
|
return match?.source;
|
|
@@ -258,6 +266,7 @@ export const Sidecar = ({
|
|
|
258
266
|
|
|
259
267
|
return getConverted(snippet, selectedLang);
|
|
260
268
|
}, [
|
|
269
|
+
showRequestBox,
|
|
261
270
|
codeSamples,
|
|
262
271
|
currentExampleCode,
|
|
263
272
|
operation,
|
|
@@ -331,82 +340,84 @@ export const Sidecar = ({
|
|
|
331
340
|
className="flex flex-col sticky top-(--scroll-padding) gap-4"
|
|
332
341
|
data-pagefind-ignore="all"
|
|
333
342
|
>
|
|
334
|
-
|
|
335
|
-
<SidecarBox.
|
|
336
|
-
<
|
|
337
|
-
<
|
|
338
|
-
<
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
343
|
+
{showRequestBox && (
|
|
344
|
+
<SidecarBox.Root>
|
|
345
|
+
<SidecarBox.Head className="py-1.5">
|
|
346
|
+
<div className="flex items-center flex-wrap gap-2 justify-between w-full">
|
|
347
|
+
<span className="font-mono wrap-break-word leading-6 space-x-1">
|
|
348
|
+
<Badge
|
|
349
|
+
variant="outline"
|
|
350
|
+
className={cn(
|
|
351
|
+
methodTextColor,
|
|
352
|
+
"px-1.5 rounded-md border-none bg-current/7 dark:bg-current/15",
|
|
353
|
+
)}
|
|
354
|
+
>
|
|
355
|
+
{operation.method.toUpperCase()}
|
|
356
|
+
</Badge>
|
|
357
|
+
{path}
|
|
358
|
+
</span>
|
|
359
|
+
{showPlayground &&
|
|
360
|
+
(isGraphQLEndpoint ? (
|
|
361
|
+
<GraphiQLDialog
|
|
362
|
+
endpoint={graphQLEndpoint?.endpoint ?? operationUrl}
|
|
363
|
+
operation={operation}
|
|
364
|
+
securitySchemes={securitySchemes}
|
|
365
|
+
defaultTabs={
|
|
366
|
+
graphQLTabs && graphQLTabs.length > 0
|
|
367
|
+
? graphQLTabs
|
|
368
|
+
: undefined
|
|
369
|
+
}
|
|
370
|
+
/>
|
|
371
|
+
) : (
|
|
372
|
+
<PlaygroundDialogWrapper
|
|
373
|
+
servers={operation.servers}
|
|
374
|
+
operation={operation}
|
|
375
|
+
examples={requestBodyContent ?? undefined}
|
|
376
|
+
/>
|
|
377
|
+
))}
|
|
378
|
+
</div>
|
|
379
|
+
</SidecarBox.Head>
|
|
380
|
+
<SidecarBox.Body>
|
|
381
|
+
{shouldLazyHighlight && !isOnScreen ? (
|
|
382
|
+
<NonHighlightedCode code={httpSnippetCode ?? ""} />
|
|
383
|
+
) : (
|
|
384
|
+
<SyntaxHighlight
|
|
385
|
+
embedded
|
|
386
|
+
language={selectedLang}
|
|
387
|
+
showLanguageIndicator={false}
|
|
388
|
+
className="[--scrollbar-color:gray] rounded-none text-xs max-h-50"
|
|
389
|
+
// biome-ignore lint/style/noNonNullAssertion: code is guaranteed to be defined
|
|
390
|
+
code={httpSnippetCode!}
|
|
391
|
+
/>
|
|
392
|
+
)}
|
|
393
|
+
</SidecarBox.Body>
|
|
394
|
+
<SidecarBox.Footer className="text-xs self-end flex justify-between items-center gap-2">
|
|
395
|
+
<NativeSelect
|
|
396
|
+
className="text-xs h-fit py-1 max-w-32 truncate bg-background"
|
|
397
|
+
value={selectedLang}
|
|
398
|
+
onChange={(e) => {
|
|
399
|
+
startTransition(() => {
|
|
400
|
+
setSearchParams((prev) => {
|
|
401
|
+
prev.set("lang", e.target.value);
|
|
402
|
+
return prev;
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
}}
|
|
406
|
+
>
|
|
407
|
+
{supportedLanguages.map((language) => (
|
|
408
|
+
<NativeSelectOption key={language.value} value={language.value}>
|
|
409
|
+
{language.label}
|
|
410
|
+
</NativeSelectOption>
|
|
367
411
|
))}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
) : (
|
|
374
|
-
<SyntaxHighlight
|
|
375
|
-
embedded
|
|
376
|
-
language={selectedLang}
|
|
377
|
-
showLanguageIndicator={false}
|
|
378
|
-
className="[--scrollbar-color:gray] rounded-none text-xs max-h-50"
|
|
379
|
-
// biome-ignore lint/style/noNonNullAssertion: code is guaranteed to be defined
|
|
380
|
-
code={httpSnippetCode!}
|
|
412
|
+
</NativeSelect>
|
|
413
|
+
<AuthSelectorPopover
|
|
414
|
+
operation={operation}
|
|
415
|
+
url={operationUrl}
|
|
416
|
+
securitySchemes={securitySchemes}
|
|
381
417
|
/>
|
|
382
|
-
|
|
383
|
-
</SidecarBox.
|
|
384
|
-
|
|
385
|
-
<NativeSelect
|
|
386
|
-
className="text-xs h-fit py-1 max-w-32 truncate bg-background"
|
|
387
|
-
value={selectedLang}
|
|
388
|
-
onChange={(e) => {
|
|
389
|
-
startTransition(() => {
|
|
390
|
-
setSearchParams((prev) => {
|
|
391
|
-
prev.set("lang", e.target.value);
|
|
392
|
-
return prev;
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}}
|
|
396
|
-
>
|
|
397
|
-
{supportedLanguages.map((language) => (
|
|
398
|
-
<NativeSelectOption key={language.value} value={language.value}>
|
|
399
|
-
{language.label}
|
|
400
|
-
</NativeSelectOption>
|
|
401
|
-
))}
|
|
402
|
-
</NativeSelect>
|
|
403
|
-
<AuthSelectorPopover
|
|
404
|
-
operation={operation}
|
|
405
|
-
url={operationUrl}
|
|
406
|
-
securitySchemes={securitySchemes}
|
|
407
|
-
/>
|
|
408
|
-
</SidecarBox.Footer>
|
|
409
|
-
</SidecarBox.Root>
|
|
418
|
+
</SidecarBox.Footer>
|
|
419
|
+
</SidecarBox.Root>
|
|
420
|
+
)}
|
|
410
421
|
|
|
411
422
|
{transformedRequestBodyContent && currentExample ? (
|
|
412
423
|
<RequestBodySidecarBox
|
|
@@ -88,6 +88,7 @@ type BaseOasConfig = {
|
|
|
88
88
|
supportedLanguages?: { value: string; label: string }[];
|
|
89
89
|
disablePlayground?: boolean;
|
|
90
90
|
disableSidecar?: boolean;
|
|
91
|
+
disableRequestBox?: boolean;
|
|
91
92
|
disableSecurity?: boolean;
|
|
92
93
|
disableMcpAuthInstructions?: boolean;
|
|
93
94
|
showVersionSelect?: "always" | "if-available" | "hide";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decides whether the request box (method and path, code snippet, language
|
|
3
|
+
* selector, playground button and auth selector) is shown at the top of an
|
|
4
|
+
* operation's sidecar.
|
|
5
|
+
*
|
|
6
|
+
* - `x-zudoku-request-box-enabled: true` shows it, even if the API sets
|
|
7
|
+
* `disableRequestBox`.
|
|
8
|
+
* - Any other explicit value hides it, matching `x-zudoku-playground-enabled`.
|
|
9
|
+
* - When unset (`undefined`), it falls back to the API's `disableRequestBox`.
|
|
10
|
+
*/
|
|
11
|
+
export const shouldShowRequestBox = (
|
|
12
|
+
extensions: Record<string, unknown> | null | undefined,
|
|
13
|
+
disableRequestBox: boolean | undefined,
|
|
14
|
+
) => {
|
|
15
|
+
const enabled = extensions?.["x-zudoku-request-box-enabled"];
|
|
16
|
+
if (enabled === undefined) return !disableRequestBox;
|
|
17
|
+
return enabled === true;
|
|
18
|
+
};
|
package/src/vite/plugin-api.ts
CHANGED
|
@@ -52,6 +52,7 @@ export const generateDefaultApiOptionsCode = () => [
|
|
|
52
52
|
` supportedLanguages: config.defaults?.apis?.supportedLanguages,`,
|
|
53
53
|
` disablePlayground: config.defaults?.apis?.disablePlayground,`,
|
|
54
54
|
` disableSidecar: config.defaults?.apis?.disableSidecar,`,
|
|
55
|
+
` disableRequestBox: config.defaults?.apis?.disableRequestBox,`,
|
|
55
56
|
` disableSecurity: config.defaults?.apis?.disableSecurity ?? true,`,
|
|
56
57
|
` disableMcpAuthInstructions: config.defaults?.apis?.disableMcpAuthInstructions,`,
|
|
57
58
|
` showVersionSelect: config.defaults?.apis?.showVersionSelect ?? "if-available",`,
|