fumadocs-openapi 8.0.3 → 8.1.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.
@@ -209,7 +209,7 @@ function usePersistentAuthInfo(authorization) {
209
209
  };
210
210
  }
211
211
  function CollapsiblePanel({ title, children, ...props }) {
212
- return (_jsxs(Collapsible, { ...props, className: "border-b last:border-b-0", children: [_jsxs(CollapsibleTrigger, { className: "group w-full flex items-center gap-2 p-3 text-sm font-medium", children: [title, _jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col gap-3 p-2", children: children }) })] }));
212
+ return (_jsxs(Collapsible, { ...props, className: "border-b last:border-b-0", children: [_jsxs(CollapsibleTrigger, { className: "group w-full flex items-center gap-2 p-3 text-sm font-medium", children: [title, _jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col gap-3 p-3 pt-1", children: children }) })] }));
213
213
  }
214
214
  function writeAuthHeader(authorization, input, header, query, cookie) {
215
215
  if (authorization.type === 'apiKey') {
@@ -1,9 +1,9 @@
1
1
  import { type HTMLAttributes } from 'react';
2
2
  import type { RenderContext } from '../types.js';
3
- export type CodeBlockProps = HTMLAttributes<HTMLPreElement> & {
3
+ export interface CodeBlockProps extends HTMLAttributes<HTMLElement> {
4
4
  code: string;
5
5
  lang: string;
6
6
  ctx: RenderContext;
7
- };
8
- export declare function CodeBlock({ code, lang, ctx, ...rest }: CodeBlockProps): Promise<React.ReactElement>;
7
+ }
8
+ export declare function CodeBlock({ code, lang, ctx, ...rest }: CodeBlockProps): Promise<import("react/jsx-runtime").JSX.Element>;
9
9
  //# sourceMappingURL=codeblock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/render/codeblock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,aAAa,CAAC;CACpB,CAAC;AAEF,wBAAsB,SAAS,CAAC,EAC9B,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAU9C"}
1
+ {"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/render/codeblock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,WAAW,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,aAAa,CAAC;CACpB;AAED,wBAAsB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,oDAc3E"}
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as Base from 'fumadocs-ui/components/codeblock';
3
3
  import { highlight } from 'fumadocs-core/highlight';
4
+ import { cn } from 'fumadocs-ui/utils/cn';
4
5
  export async function CodeBlock({ code, lang, ctx, ...rest }) {
5
6
  const rendered = await highlight(code, {
6
7
  lang,
7
8
  ...ctx.shikiOptions,
8
9
  components: {
9
- pre: (props) => _jsx(Base.Pre, { ...props, ...rest }),
10
+ pre: (props) => _jsx(Base.Pre, { ...props }),
10
11
  },
11
12
  });
12
- return _jsx(Base.CodeBlock, { className: "my-0", children: rendered });
13
+ return (_jsx(Base.CodeBlock, { className: cn('my-0', rest.className), children: rendered }));
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-example.d.ts","sourceRoot":"","sources":["../../../src/render/operation/api-example.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAU3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAqBtD,UAAU,cAAc;IACtB,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAeA;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,aAAa,GACjB,eAAe,EAAE,CA8BnB;AAED,wBAAsB,UAAU,CAAC,EAC/B,MAAM,EACN,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,EAA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a,CAAC;CACpB,oDAmCA"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Markdown } from '../../render/markdown.js';
3
- import { getTypescriptSchema } from '../../utils/get-typescript-schema.js';
4
3
  import { CodeBlock } from '../../render/codeblock.js';
5
4
  import { CodeExample, CodeExampleProvider, } from '../../ui/contexts/code-example.lazy.js';
6
5
  import { getPreferredType } from '../../utils/schema.js';
@@ -86,40 +85,27 @@ function dedupe(samples) {
86
85
  return out;
87
86
  }
88
87
  function ResponseTabs({ operation, ctx, }) {
89
- const { renderer, generateTypeScriptSchema, schema } = ctx;
88
+ const { renderer } = ctx;
90
89
  if (!operation.responses)
91
90
  return null;
92
91
  async function renderResponse(code) {
93
- const response = operation.responses && code in operation.responses
94
- ? operation.responses[code]
95
- : null;
96
- const media = getPreferredType(response?.content ?? {});
92
+ const response = operation.responses?.[code];
93
+ const media = response?.content ? getPreferredType(response.content) : null;
97
94
  const responseOfType = media ? response?.content?.[media] : null;
98
- const description = operation.responses?.[code].description ??
99
- responseOfType?.schema?.description ??
100
- '';
101
- let ts;
102
- if (generateTypeScriptSchema) {
103
- ts = await generateTypeScriptSchema(operation, code);
104
- }
105
- else if (generateTypeScriptSchema === undefined &&
106
- responseOfType?.schema) {
107
- ts = await getTypescriptSchema(responseOfType?.schema, schema.dereferenceMap);
108
- }
109
- const values = [];
110
- let exampleSlot;
95
+ let slot = 'Empty';
111
96
  if (responseOfType?.examples) {
112
- exampleSlot = Object.entries(responseOfType.examples).map(([key, sample], i) => {
113
- const title = sample?.summary ?? `Example ${i + 1}`;
97
+ const values = [];
98
+ const children = Object.entries(responseOfType.examples).map(([key, sample]) => {
99
+ const title = sample?.summary ?? `Example ${key}`;
114
100
  values.push(title);
115
- return (_jsxs(renderer.ResponseType, { label: title, children: [sample?.description ? (_jsx(Markdown, { text: sample.description })) : null, _jsx(CodeBlock, { lang: "json", code: JSON.stringify(sample.value, null, 2), ctx: ctx })] }, key));
101
+ return (_jsxs(renderer.ResponseType, { label: title, children: [sample?.description && _jsx(Markdown, { text: sample.description }), _jsx(CodeBlock, { lang: "json", code: JSON.stringify(sample.value, null, 2), ctx: ctx })] }, key));
116
102
  });
103
+ slot = (_jsx(renderer.ResponseTypes, { defaultValue: values[0], children: children }));
117
104
  }
118
105
  else if (responseOfType?.example || responseOfType?.schema) {
119
- values.push('Response');
120
- exampleSlot = (_jsx(renderer.ResponseType, { label: "Response", children: _jsx(CodeBlock, { lang: "json", code: JSON.stringify(responseOfType.example ?? sample(responseOfType.schema), null, 2), ctx: ctx }) }));
106
+ slot = (_jsx(CodeBlock, { lang: "json", code: JSON.stringify(responseOfType.example ?? sample(responseOfType.schema), null, 2), ctx: ctx }));
121
107
  }
122
- return (_jsxs(renderer.Response, { value: code, children: [description ? _jsx(Markdown, { text: description }) : null, exampleSlot ? (_jsxs(renderer.ResponseTypes, { defaultValue: values[0], children: [exampleSlot, ts ? (_jsx(renderer.ResponseType, { label: "TypeScript", children: _jsx(CodeBlock, { lang: "ts", code: ts, ctx: ctx }) })) : null] })) : null] }));
108
+ return _jsx(renderer.Response, { value: code, children: slot });
123
109
  }
124
110
  const codes = Object.keys(operation.responses);
125
111
  if (codes.length === 0)
@@ -1,6 +1,6 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { MethodInformation, RenderContext } from '../../types.js';
3
- import { RequestData } from '../../requests/_shared.js';
3
+ import { type RequestData } from '../../requests/_shared.js';
4
4
  export interface CodeSample {
5
5
  lang: string;
6
6
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/operation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAEV,iBAAiB,EAEjB,aAAa,EAEd,MAAM,SAAS,CAAC;AAgBjB,OAAO,EAAE,WAAW,EAAuB,MAAM,oBAAoB,CAAC;AAEtE,MA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;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;IAEnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,YAAY,CAiLf"}
@@ -11,6 +11,9 @@ import { methodKeys } from '../../build-routes.js';
11
11
  import { APIExample, APIExampleProvider, getAPIExamples, } from '../../render/operation/api-example.js';
12
12
  import { MethodLabel } from '../../ui/components/method-label.js';
13
13
  import { supportedMediaTypes } from '../../requests/_shared.js';
14
+ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
15
+ import { CodeBlock } from '../../render/codeblock.js';
16
+ import { getTypescriptSchema } from '../../utils/get-typescript-schema.js';
14
17
  const ParamTypes = {
15
18
  path: 'Path Parameters',
16
19
  query: 'Query Parameters',
@@ -42,23 +45,9 @@ export function Operation({ type = 'operation', path, method, ctx, hasHead, head
42
45
  allowFile: type === 'multipart/form-data',
43
46
  } })] }));
44
47
  }
45
- if (method.responses && ctx.showResponseSchema) {
46
- responseNode = (_jsxs(_Fragment, { children: [heading(headingLevel, 'Response Body', ctx), Object.entries(method.responses).map(([status, response]) => {
47
- if (!response.content)
48
- return;
49
- const mediaType = getPreferredType(response.content);
50
- if (!mediaType)
51
- return null;
52
- const content = response.content[mediaType];
53
- if (!content.schema)
54
- return null;
55
- return (_jsxs(Fragment, { children: [heading(headingLevel + 1, status, ctx), _jsx(Markdown, { text: response.description }), _jsx(Schema, { name: "response", schema: content.schema, ctx: {
56
- render: ctx,
57
- writeOnly: false,
58
- readOnly: true,
59
- required: true,
60
- } })] }, status));
61
- })] }));
48
+ if (method.responses && ctx.showResponseSchema !== false) {
49
+ const statuses = Object.keys(method.responses);
50
+ responseNode = (_jsxs(_Fragment, { children: [heading(headingLevel, 'Response Body', ctx), _jsx(Tabs, { items: statuses, groupId: "fumadocs_openapi_responses", className: "bg-transparent", children: statuses.map((status) => (_jsx(ResponseTab, { status: status, operation: method, ctx: ctx }, status))) })] }));
62
51
  }
63
52
  const parameterNode = Object.entries(ParamTypes).map(([type, title]) => {
64
53
  const params = method.parameters?.filter((param) => param.in === type);
@@ -92,6 +81,28 @@ export function Operation({ type = 'operation', path, method, ctx, hasHead, head
92
81
  return info;
93
82
  }
94
83
  }
84
+ async function ResponseTab({ status, operation, ctx, }) {
85
+ const response = operation.responses[status];
86
+ const { generateTypeScriptSchema, schema } = ctx;
87
+ const mediaType = response.content
88
+ ? getPreferredType(response.content)
89
+ : null;
90
+ const responseOfType = mediaType ? response.content?.[mediaType] : null;
91
+ const description = responseOfType?.schema?.description ?? response.description ?? '';
92
+ let ts;
93
+ if (generateTypeScriptSchema) {
94
+ ts = await generateTypeScriptSchema(operation, status);
95
+ }
96
+ else if (generateTypeScriptSchema === undefined && responseOfType?.schema) {
97
+ ts = await getTypescriptSchema(responseOfType?.schema, schema.dereferenceMap);
98
+ }
99
+ return (_jsxs(Tab, { value: status, children: [_jsx(Markdown, { text: description }), responseOfType?.schema && (_jsx(Schema, { name: "response", schema: responseOfType.schema, ctx: {
100
+ render: ctx,
101
+ writeOnly: false,
102
+ readOnly: true,
103
+ required: true,
104
+ } })), ts && _jsx(CodeBlock, { lang: "ts", code: ts, ctx: ctx, className: "mt-4" })] }));
105
+ }
95
106
  function WebhookCallback({ callback, ctx, headingLevel, }) {
96
107
  return Object.entries(callback).map(([path, pathItem]) => {
97
108
  const pathNodes = methodKeys.map((method) => {
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWtD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IA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C5C,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,UAAU,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAEnD,SAAS,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACzC,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,mBAAmB,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAClE,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,aAAa,EAAE,aAAa,CAAC;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC7E,YAAY,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAE/C;;OAEG;IACH,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IACzD,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAClD;AAED,wBAAgB,aAAa,CAC3B,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,GAC1C,QAAQ,CAyCV"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
3
3
  import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
4
- import { API, Root, APIInfo, APIExample, Property, ObjectCollapsible, } from '../ui/index.js';
4
+ import { API, APIExample, APIInfo, ObjectCollapsible, Property, Root, } from '../ui/index.js';
5
5
  import { APIPlayground } from '../playground/index.js';
6
6
  import { CodeExampleSelector } from '../ui/contexts/code-example.lazy.js';
7
7
  export function createRenders(shikiOptions) {
@@ -10,7 +10,7 @@ export function createRenders(shikiOptions) {
10
10
  API,
11
11
  APIInfo: ({ children, head }) => (_jsxs(APIInfo, { children: [head, children] })),
12
12
  APIExample,
13
- Responses: Tabs,
13
+ Responses: (props) => (_jsx(Tabs, { ...props, groupId: "fumadocs_openapi_responses" })),
14
14
  Response: Tab,
15
15
  ResponseTypes: (props) => (_jsx(Accordions, { type: "single", className: "!-m-4 border-none pt-2", defaultValue: props.defaultValue, children: props.children })),
16
16
  ResponseType: (props) => (_jsx(Accordion, { title: props.label, children: props.children })),
package/dist/types.d.ts CHANGED
@@ -56,6 +56,8 @@ export interface RenderContext {
56
56
  shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
57
57
  /**
58
58
  * Show full response schema instead of only example response & Typescript definitions
59
+ *
60
+ * @default true
59
61
  */
60
62
  showResponseSchema?: boolean;
61
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACrC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,IA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3",
3
+ "version": "8.1.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -16,6 +16,7 @@
16
16
  "import": "./dist/index.js",
17
17
  "types": "./dist/index.d.ts"
18
18
  },
19
+ "./css/*": "./css/*",
19
20
  "./ui": {
20
21
  "import": "./dist/ui/index.js",
21
22
  "types": "./dist/ui/index.d.ts"
@@ -44,8 +45,8 @@
44
45
  ],
45
46
  "dependencies": {
46
47
  "@fumari/json-schema-to-typescript": "^1.1.3",
47
- "@radix-ui/react-dialog": "^1.1.7",
48
- "@radix-ui/react-select": "^2.1.7",
48
+ "@radix-ui/react-dialog": "^1.1.10",
49
+ "@radix-ui/react-select": "^2.2.2",
49
50
  "@radix-ui/react-slot": "^1.2.0",
50
51
  "@scalar/openapi-parser": "0.10.16",
51
52
  "ajv-draft-04": "^1.0.0",
@@ -54,19 +55,19 @@
54
55
  "github-slugger": "^2.0.0",
55
56
  "hast-util-to-jsx-runtime": "^2.3.6",
56
57
  "js-yaml": "^4.1.0",
57
- "lucide-react": "^0.488.0",
58
+ "lucide-react": "^0.503.0",
58
59
  "next-themes": "^0.4.6",
59
60
  "openapi-sampler": "^1.6.1",
60
- "react-hook-form": "^7.55.0",
61
+ "react-hook-form": "^7.56.0",
61
62
  "remark": "^15.0.1",
62
63
  "remark-rehype": "^11.1.2",
63
- "shiki": "^3.2.2",
64
+ "shiki": "^3.3.0",
64
65
  "xml-js": "^1.6.11",
65
- "fumadocs-core": "15.2.9",
66
- "fumadocs-ui": "15.2.9"
66
+ "fumadocs-core": "15.2.10",
67
+ "fumadocs-ui": "15.2.10"
67
68
  },
68
69
  "devDependencies": {
69
- "@scalar/api-client-react": "^1.2.22",
70
+ "@scalar/api-client-react": "^1.2.23",
70
71
  "@types/js-yaml": "^4.0.9",
71
72
  "@types/node": "22.14.1",
72
73
  "@types/openapi-sampler": "^1.0.3",