fumadocs-openapi 8.1.0 → 8.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-file.d.ts","sourceRoot":"","sources":["../src/generate-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,MAAO,SAAQ,eAAe;IAC7C;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;IAEnC;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;CACpC;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiIlE"}
1
+ {"version":3,"file":"generate-file.d.ts","sourceRoot":"","sources":["../src/generate-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,MAAO,SAAQ,eAAe;IAC7C;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;IAEnC;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;CACpC;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+HlE"}
@@ -1,8 +1,7 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join, parse } from 'node:path';
3
3
  import fg from 'fast-glob';
4
- import { generatePages, } from './generate.js';
5
- import { generateAll, generateTags } from './generate.js';
4
+ import { generateAll, generatePages, generateTags, } from './generate.js';
6
5
  export async function generateFiles(options) {
7
6
  const { input, output, name: nameFn, per = 'operation', groupBy = 'none', cwd = process.cwd(), } = options;
8
7
  const outputDir = join(cwd, output);
@@ -29,9 +28,7 @@ export async function generateFiles(options) {
29
28
  file = getFilename(result.pathItem.summary);
30
29
  }
31
30
  else if (result.type === 'operation') {
32
- file = result.operation.operationId
33
- ? getFilename(result.operation.operationId)
34
- : join(getOutputPathFromRoute(result.item.path), result.item.method.toLowerCase());
31
+ file = join(getOutputPathFromRoute(result.item.path), result.item.method.toLowerCase());
35
32
  }
36
33
  else {
37
34
  file = getFilename(result.item.name);
@@ -109,10 +106,7 @@ function getOutputPathFromRoute(path) {
109
106
  .at(-1) ?? '');
110
107
  }
111
108
  function getFilename(s) {
112
- return s
113
- .replace(/[A-Z]/g, (match, idx) => idx === 0 ? match : `-${match.toLowerCase()}`)
114
- .replace(/\s+/g, '-')
115
- .toLowerCase();
109
+ return s.replace(/\s+/g, '-').toLowerCase();
116
110
  }
117
111
  async function write(path, content) {
118
112
  await mkdir(dirname(path), { recursive: true });
@@ -18,7 +18,9 @@ export interface GenerateOptions {
18
18
  */
19
19
  frontmatter?: (title: string, description: string | undefined, context: DocumentContext) => Record<string, unknown>;
20
20
  /**
21
- * Add description to document body
21
+ * Add description to document body.
22
+ *
23
+ * We recommend but don't enable it by default because some OpenAPI schemas have invalid description that breaks MDX syntax.
22
24
  *
23
25
  * @defaultValue false
24
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,0BAA0B,CAAC;AAE/E,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IAEJ;;;;OAIG;IACH,WAAW,CAAC,EAAE,CACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,OAAO,EAAE,eAAe,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEvC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAC1B;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACtC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAExC,IAAI,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ceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
package/dist/icons.js ADDED
@@ -0,0 +1 @@
1
+ export * from 'fumadocs-ui/internal/icons';
@@ -1,7 +1,7 @@
1
1
  import { type FC, type HTMLAttributes, type ReactElement, type RefObject } from 'react';
2
2
  import type { ControllerFieldState, ControllerRenderProps, FieldPath, UseFormStateReturn } from 'react-hook-form';
3
3
  import type { FetchResult } from '../playground/fetcher.js';
4
- import type { PrimitiveRequestField, ReferenceSchema, RequestSchema } from '../playground/index.js';
4
+ import type { ParameterField, ReferenceSchema, RequestSchema } from '../playground/index.js';
5
5
  import type { Security } from '../utils/get-security.js';
6
6
  interface FormValues {
7
7
  authorization: string | {
@@ -31,7 +31,7 @@ export type ClientProps = HTMLAttributes<HTMLFormElement> & {
31
31
  authorization?: Security & {
32
32
  persistentId: string;
33
33
  };
34
- parameters?: PrimitiveRequestField[];
34
+ parameters?: ParameterField[];
35
35
  body?: RequestSchema & {
36
36
  mediaType: string;
37
37
  };
@@ -41,7 +41,7 @@ export type ClientProps = HTMLAttributes<HTMLFormElement> & {
41
41
  references: Record<string, RequestSchema>;
42
42
  proxyUrl?: string;
43
43
  fields?: {
44
- parameter?: CustomField<`${PrimitiveRequestField['in']}.${string}`, PrimitiveRequestField>;
44
+ parameter?: CustomField<`${ParameterField['in']}.${string}`, ParameterField>;
45
45
  auth?: CustomField<'authorization', RequestSchema>;
46
46
  body?: CustomField<'body', RequestSchema>;
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/playground/client.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,EAAE,EAEP,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAQzB,O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,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,UAAU,EAAE,EAAE,aAAoC,EAAO,EACzD,GAAG,IAAI,EACR,EAAE,WAAW,2CAuHb"}
@@ -11,7 +11,7 @@ import { MethodLabel } from '../ui/components/method-label.js';
11
11
  import { useQuery } from '../utils/use-query.js';
12
12
  import ServerSelect from '../ui/server-select.js';
13
13
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
14
- import { ChevronDown, Loader2 } from 'lucide-react';
14
+ import { ChevronDown, LoaderCircle } from '../icons.js';
15
15
  import { OauthDialog, OauthDialogTrigger, } from '../playground/auth/oauth-dialog.js';
16
16
  import { useRequestData } from '../ui/contexts/code-example.js';
17
17
  import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
@@ -83,7 +83,7 @@ export default function Client({ route, method = 'GET', authorization, parameter
83
83
  const onSubmit = form.handleSubmit((value) => {
84
84
  testQuery.start(value);
85
85
  });
86
- return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...rest, className: cn('not-prose flex flex-col rounded-xl border shadow-md overflow-hidden bg-fd-card text-fd-card-foreground', rest.className), onSubmit: onSubmit, children: [_jsxs("div", { className: "flex flex-row items-center gap-2 text-sm p-3 pb-0", children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: testQuery.isLoading, children: testQuery.isLoading ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : ('Send') })] }), _jsx(FormBody, { body: body, fields: fields, parameters: parameters, authorization: authorization }), testQuery.data ? _jsx(ResultDisplay, { data: testQuery.data }) : null] }) }) }) }));
86
+ return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...rest, className: cn('not-prose flex flex-col rounded-xl border shadow-md overflow-hidden bg-fd-card text-fd-card-foreground', rest.className), onSubmit: onSubmit, children: [_jsxs("div", { className: "flex flex-row items-center gap-2 text-sm p-3 pb-0", children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: testQuery.isLoading, children: testQuery.isLoading ? (_jsx(LoaderCircle, { className: "size-4 animate-spin" })) : ('Send') })] }), _jsx(FormBody, { body: body, fields: fields, parameters: parameters, authorization: authorization }), testQuery.data ? _jsx(ResultDisplay, { data: testQuery.data }) : null] }) }) }) }));
87
87
  }
88
88
  const paramNames = ['Headers', 'Cookies', 'Query', 'Path'];
89
89
  const paramTypes = ['header', 'cookie', 'query', 'path'];
@@ -1,14 +1,12 @@
1
1
  import type { MethodInformation, RenderContext } from '../types.js';
2
2
  import { type ClientProps } from './client.js';
3
- interface BaseRequestField {
4
- name: string;
5
- description?: string;
6
- }
7
3
  interface BaseSchema {
8
4
  description?: string;
9
5
  isRequired: boolean;
10
6
  }
11
- export type PrimitiveRequestField = BaseRequestField & PrimitiveSchema & {
7
+ export type ParameterField = (PrimitiveSchema | ArraySchema) & {
8
+ name: string;
9
+ description?: string;
12
10
  in: 'cookie' | 'header' | 'query' | 'path';
13
11
  };
14
12
  interface PrimitiveSchema extends BaseSchema {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/playground/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAA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AM,EAAE,aAAa,GAAG,eAAe,CAAC,CAAC;IAE5D;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACzC;AAED,UAAU,cAAe,SAAQ,UAAU;IACzC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,CAAC,CAAC;CACxD;AAED,UAAU,UAAW,SAAQ,UAAU;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,WAAW,GACX,YAAY,GACZ,cAAc,GACd,UAAU,GACV,UAAU,CAAC;AAUf,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;IAEnB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B;AAED,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,wBAAsB,aAAa,CAAC,EAClC,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,GACP,EAAE,kBAAkB,oDAsCpB"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState, } from 'react';
4
- import { Plus, Trash2 } from 'lucide-react';
4
+ import { Plus, Trash2 } from '../icons.js';
5
5
  import { Controller, useController, useFieldArray, useFormContext, } from 'react-hook-form';
6
6
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select.js';
7
7
  import { resolve } from '../playground/resolve.js';
@@ -185,10 +185,11 @@ export function FieldSet({ field, fieldName, toolbar, name, ...props }) {
185
185
  function ArrayInput({ fieldName, field, ...props }) {
186
186
  const { references } = useSchemaContext();
187
187
  const items = resolve(field.items, references);
188
+ const name = fieldName.split('.').at(-1) ?? '';
188
189
  const { fields, append, remove } = useFieldArray({
189
190
  name: fieldName,
190
191
  });
191
- return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name: _jsxs("span", { className: "text-fd-muted-foreground", children: [fieldName.split('.').at(-1), "[", index, "]"] }), field: items, fieldName: `${fieldName}.${index}`, toolbar: _jsx("button", { type: "button", "aria-label": "Remove Item", className: cn(buttonVariants({
192
+ return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name: _jsxs("span", { className: "text-fd-muted-foreground", children: [name, "[", index, "]"] }), field: items, fieldName: `${fieldName}.${index}`, toolbar: _jsx("button", { type: "button", "aria-label": "Remove Item", className: cn(buttonVariants({
192
193
  color: 'secondary',
193
194
  size: 'sm',
194
195
  })), onClick: () => {
@@ -1,21 +1,21 @@
1
- import { CircleCheckIcon, CircleXIcon } from 'lucide-react';
1
+ import { CircleCheck, CircleX } from '../icons.js';
2
2
  const statusMap = {
3
- 400: { description: 'Bad Request', color: 'text-red-500', icon: CircleXIcon },
3
+ 400: { description: 'Bad Request', color: 'text-red-500', icon: CircleX },
4
4
  401: {
5
5
  description: 'Unauthorized',
6
6
  color: 'text-red-500',
7
- icon: CircleXIcon,
7
+ icon: CircleX,
8
8
  },
9
- 403: { description: 'Forbidden', color: 'text-red-500', icon: CircleXIcon },
9
+ 403: { description: 'Forbidden', color: 'text-red-500', icon: CircleX },
10
10
  404: {
11
11
  description: 'Not Found',
12
12
  color: 'text-fd-muted-foreground',
13
- icon: CircleXIcon,
13
+ icon: CircleX,
14
14
  },
15
15
  500: {
16
16
  description: 'Internal Server Error',
17
17
  color: 'text-red-500',
18
- icon: CircleXIcon,
18
+ icon: CircleX,
19
19
  },
20
20
  };
21
21
  export function getStatusInfo(status) {
@@ -26,15 +26,15 @@ export function getStatusInfo(status) {
26
26
  return {
27
27
  description: 'Successful',
28
28
  color: 'text-green-500',
29
- icon: CircleCheckIcon,
29
+ icon: CircleCheck,
30
30
  };
31
31
  }
32
32
  if (status >= 400) {
33
- return { description: 'Error', color: 'text-red-500', icon: CircleXIcon };
33
+ return { description: 'Error', color: 'text-red-500', icon: CircleX };
34
34
  }
35
35
  return {
36
36
  description: 'No Description',
37
37
  color: 'text-fd-muted-foreground',
38
- icon: CircleXIcon,
38
+ icon: CircleX,
39
39
  };
40
40
  }
@@ -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;AAejB,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,oBAAoB,CAAC;AAK3E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC,GACxD,KAAK,CAAC;CACX;AASD,wBAAgB,SAAS,CAAC,EACxB,IAAkB,EAClB,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;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"}
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;AAejB,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,oBAAoB,CAAC;AAK3E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC,GACxD,KAAK,CAAC;CACX;AASD,wBAAgB,SAAS,CAAC,EACxB,IAAkB,EAClB,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;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,CAgLf"}
@@ -37,12 +37,10 @@ export function Operation({ type = 'operation', path, method, ctx, hasHead, head
37
37
  if (!type ||
38
38
  !supportedMediaTypes.includes(String(type)))
39
39
  throw new Error(`No supported media type for body content: ${path}, received: ${type}`);
40
- bodyNode = (_jsxs(_Fragment, { children: [heading(headingLevel, 'Request Body', ctx), _jsxs("div", { className: "mb-8 flex flex-row items-center justify-between gap-2", children: [_jsx("code", { children: type }), _jsx("span", { children: body.required ? 'Required' : 'Optional' })] }), body.description ? _jsx(Markdown, { text: body.description }) : null, _jsx(Schema, { name: "body", schema: body.content[type].schema ?? {}, ctx: {
40
+ bodyNode = (_jsxs(_Fragment, { children: [heading(headingLevel, 'Request Body', ctx), _jsxs("div", { className: "mb-8 flex flex-row items-center justify-between gap-2", children: [_jsx("code", { children: type }), _jsx("span", { children: body.required ? 'Required' : 'Optional' })] }), body.description ? _jsx(Markdown, { text: body.description }) : null, _jsx(Schema, { name: "body", schema: body.content[type].schema ?? {}, required: body.required, ctx: {
41
41
  readOnly: method.method === 'GET',
42
42
  writeOnly: method.method !== 'GET',
43
- required: body.required ?? false,
44
43
  render: ctx,
45
- allowFile: type === 'multipart/form-data',
46
44
  } })] }));
47
45
  }
48
46
  if (method.responses && ctx.showResponseSchema !== false) {
@@ -58,11 +56,9 @@ export function Operation({ type = 'operation', path, method, ctx, hasHead, head
58
56
  description: param.description ?? param.schema?.description,
59
57
  deprecated: (param.deprecated ?? false) ||
60
58
  (param.schema?.deprecated ?? false),
61
- }, ctx: {
62
- parseObject: false,
59
+ }, parseObject: false, required: param.required, ctx: {
63
60
  readOnly: method.method === 'GET',
64
61
  writeOnly: method.method !== 'GET',
65
- required: param.required ?? false,
66
62
  render: ctx,
67
63
  } }, param.name))) })] }, type));
68
64
  });
@@ -96,11 +92,10 @@ async function ResponseTab({ status, operation, ctx, }) {
96
92
  else if (generateTypeScriptSchema === undefined && responseOfType?.schema) {
97
93
  ts = await getTypescriptSchema(responseOfType?.schema, schema.dereferenceMap);
98
94
  }
99
- return (_jsxs(Tab, { value: status, children: [_jsx(Markdown, { text: description }), responseOfType?.schema && (_jsx(Schema, { name: "response", schema: responseOfType.schema, ctx: {
95
+ return (_jsxs(Tab, { value: status, children: [_jsx(Markdown, { text: description }), responseOfType?.schema && (_jsx(Schema, { name: "response", schema: responseOfType.schema, required: true, ctx: {
100
96
  render: ctx,
101
97
  writeOnly: false,
102
98
  readOnly: true,
103
- required: true,
104
99
  } })), ts && _jsx(CodeBlock, { lang: "ts", code: ts, ctx: ctx, className: "mt-4" })] }));
105
100
  }
106
101
  function WebhookCallback({ callback, ctx, headingLevel, }) {
@@ -4,25 +4,19 @@ import type { RenderContext } from '../types.js';
4
4
  interface Context {
5
5
  readOnly: boolean;
6
6
  writeOnly: boolean;
7
- required: boolean;
7
+ stack?: ParsedSchema[];
8
+ render: RenderContext;
9
+ }
10
+ export declare function Schema({ name, schema, required, parseObject, ctx, }: {
11
+ name: string;
12
+ required?: boolean;
13
+ schema: NoReference<ParsedSchema>;
8
14
  /**
9
15
  * Render the full object
10
16
  *
11
17
  * @defaultValue true
12
18
  * */
13
19
  parseObject?: boolean;
14
- /**
15
- * Parse binary format string to be files
16
- *
17
- * @defaultValue false
18
- */
19
- allowFile?: boolean;
20
- stack?: ParsedSchema[];
21
- render: RenderContext;
22
- }
23
- export declare function Schema({ name, schema, ctx, }: {
24
- name: string;
25
- schema: NoReference<ParsedSchema>;
26
20
  ctx: Context;
27
21
  }): ReactNode;
28
22
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/render/schema.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgB7C,UAAU,OAAO;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IAEnB,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;SAIK;IACL,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IAEvB,MAAM,EAAE,aAAa,CAAC;CACvB;AAUD,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IAClC,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,SAAS,CA8JZ"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/render/schema.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgB7C,UAAU,OAAO;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IAEvB,MAAM,EAAE,aAAa,CAAC;CACvB;AAUD,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,MAAM,EACN,QAAgB,EAChB,WAAkB,EAClB,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IAElC;;;;SAIK;IACL,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,SAAS,CAmKZ"}
@@ -16,13 +16,11 @@ function isObject(schema) {
16
16
  schema.properties !== undefined ||
17
17
  schema.additionalProperties !== undefined);
18
18
  }
19
- export function Schema({ name, schema, ctx, }) {
19
+ export function Schema({ name, schema, required = false, parseObject = true, ctx, }) {
20
20
  if ((schema.readOnly === true && !ctx.readOnly) ||
21
21
  (schema.writeOnly === true && !ctx.writeOnly))
22
22
  return null;
23
- const parseObject = ctx.parseObject ?? true;
24
- const stack = ctx.stack ?? [];
25
- const { renderer } = ctx.render;
23
+ const { render: { renderer }, stack = [], } = ctx;
26
24
  // object type
27
25
  if (isObject(schema) &&
28
26
  parseObject &&
@@ -34,25 +32,26 @@ export function Schema({ name, schema, ctx, }) {
34
32
  footer = _jsx(renderer.Property, { name: "[key: string]", type: "any" });
35
33
  }
36
34
  else if (additionalProperties) {
37
- footer = (_jsx(Schema, { name: "[key: string]", schema: additionalProperties, ctx: {
35
+ footer = (_jsx(Schema, { name: "[key: string]", schema: additionalProperties, parseObject: false, ctx: {
38
36
  ...ctx,
39
- required: false,
40
- parseObject: false,
37
+ stack: [schema, ...stack],
41
38
  } }));
42
39
  }
43
40
  if (properties) {
44
41
  body = Object.entries(properties).map(([key, value]) => {
45
- return (_jsx(Schema, { name: key, schema: value, ctx: {
42
+ return (_jsx(Schema, { name: key, schema: value, parseObject: false, required: schema.required?.includes(key) ?? false, ctx: {
46
43
  ...ctx,
47
- required: schema.required?.includes(key) ?? false,
48
- parseObject: false,
44
+ stack: [schema, ...stack],
49
45
  } }, key));
50
46
  });
51
47
  }
52
48
  return (_jsxs("div", { className: "flex flex-col gap-4", children: [body, footer] }));
53
49
  }
54
50
  if (schema.allOf && parseObject) {
55
- return (_jsx(Schema, { name: name, schema: combineSchema(schema.allOf), ctx: ctx }));
51
+ return (_jsx(Schema, { name: name, schema: combineSchema(schema.allOf), ctx: {
52
+ ...ctx,
53
+ stack: [schema, ...stack],
54
+ } }));
56
55
  }
57
56
  let footer;
58
57
  const fields = [];
@@ -73,8 +72,6 @@ export function Schema({ name, schema, ctx, }) {
73
72
  if (isObject(schema) && !parseObject && !stack.includes(schema)) {
74
73
  footer = (_jsx(renderer.ObjectCollapsible, { name: "Show Attributes", children: _jsx(Schema, { name: name, schema: schema, ctx: {
75
74
  ...ctx,
76
- parseObject: true,
77
- required: false,
78
75
  stack: [schema, ...stack],
79
76
  } }) }));
80
77
  }
@@ -82,7 +79,7 @@ export function Schema({ name, schema, ctx, }) {
82
79
  const mentionedObjectTypes = [
83
80
  ...(schema.anyOf ?? schema.oneOf ?? []),
84
81
  ...(schema.not ? [schema.not] : []),
85
- ...(schema.type === 'array' ? [schema.items] : []),
82
+ ...(schema.type === 'array' && schema.items ? [schema.items] : []),
86
83
  ].filter((s) => isComplexType(s) && !stack.includes(s));
87
84
  footer = mentionedObjectTypes.map((s, idx) => {
88
85
  return (_jsx(renderer.ObjectCollapsible, { name: s.title ??
@@ -91,12 +88,10 @@ export function Schema({ name, schema, ctx, }) {
91
88
  : `Object ${idx + 1}`), children: _jsx(Schema, { name: "element", schema: s, ctx: {
92
89
  ...ctx,
93
90
  stack: [schema, ...stack],
94
- parseObject: true,
95
- required: false,
96
91
  } }) }, idx));
97
92
  });
98
93
  }
99
- return (_jsxs(renderer.Property, { name: name, type: getSchemaType(schema, ctx), required: ctx.required, deprecated: schema.deprecated, children: [schema.description ? _jsx(Markdown, { text: schema.description }) : null, fields.length > 0 ? (_jsx("div", { className: "flex flex-col gap-2", children: fields.map((field) => (_jsxs("span", { children: [field.key, ": ", _jsx("code", { children: field.value })] }, field.key))) })) : null, footer] }));
94
+ return (_jsxs(renderer.Property, { name: name, type: getSchemaType(schema, ctx), required: required, deprecated: schema.deprecated, children: [schema.description ? _jsx(Markdown, { text: schema.description }) : null, fields.length > 0 ? (_jsx("div", { className: "flex flex-col gap-2", children: fields.map((field) => (_jsxs("span", { children: [field.key, ": ", _jsx("code", { children: field.value })] }, field.key))) })) : null, footer] }));
100
95
  }
101
96
  /**
102
97
  * Check if the schema needs another collapsible to explain
@@ -115,7 +110,7 @@ function getSchemaType(schema, ctx, isRoot = true) {
115
110
  if (schema.title)
116
111
  return schema.title;
117
112
  if (schema.type === 'array')
118
- return `array<${getSchemaType(schema.items, ctx)}>`;
113
+ return `array<${schema.items ? getSchemaType(schema.items, ctx) : 'unknown'}>`;
119
114
  if (schema.oneOf)
120
115
  return schema.oneOf
121
116
  .map((one) => getSchemaType(one, ctx, false))
@@ -141,7 +136,7 @@ function getSchemaType(schema, ctx, isRoot = true) {
141
136
  }
142
137
  // otherwise unknown
143
138
  }
144
- if (schema.type === 'string' && schema.format === 'binary' && ctx.allowFile)
139
+ if (schema.type === 'string' && schema.format === 'binary')
145
140
  return 'file';
146
141
  if (schema.type && Array.isArray(schema.type)) {
147
142
  const nonNullTypes = schema.type.filter((v) => v !== 'null');
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import * as DialogPrimitive from '@radix-ui/react-dialog';
5
- import { X } from 'lucide-react';
5
+ import { X } from '../../icons.js';
6
6
  import { cn } from 'fumadocs-ui/utils/cn';
7
7
  const Dialog = DialogPrimitive.Root;
8
8
  const DialogTrigger = DialogPrimitive.Trigger;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as SelectPrimitive from '@radix-ui/react-select';
3
- import { Check, ChevronDown, ChevronUp } from 'lucide-react';
3
+ import { Check, ChevronDown, ChevronUp } from '../../icons.js';
4
4
  import { forwardRef } from 'react';
5
5
  import { cn } from 'fumadocs-ui/utils/cn';
6
6
  const Select = SelectPrimitive.Root;
package/dist/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Badge } from '../ui/components/method-label.js';
3
3
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
4
- import { ChevronDown } from 'lucide-react';
4
+ import { ChevronDown } from '../icons.js';
5
5
  import { ApiProvider } from '../ui/contexts/api.js';
6
6
  import { cn } from 'fumadocs-ui/utils/cn';
7
7
  import { buttonVariants } from 'fumadocs-ui/components/ui/button';
@@ -1 +1 @@
1
- {"version":3,"file":"get-pathname-from-input.d.ts","sourceRoot":"","sources":["../../src/utils/get-pathname-from-input.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAsBR"}
1
+ {"version":3,"file":"get-pathname-from-input.d.ts","sourceRoot":"","sources":["../../src/utils/get-pathname-from-input.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CA0BR"}
@@ -1,19 +1,27 @@
1
1
  export function getPathnameFromInput(url, path, query) {
2
2
  let pathname = url;
3
3
  for (const key in path) {
4
- const paramValue = path[key];
5
- if (typeof paramValue === 'string' && paramValue.length > 0)
6
- pathname = pathname.replace(`{${key}}`, paramValue);
7
- else if (typeof paramValue === 'number')
8
- pathname = pathname.replace(`{${key}}`, paramValue.toString());
4
+ if (path[key] === '')
5
+ continue;
6
+ if (Array.isArray(path[key])) {
7
+ pathname = pathname.replace(`{${key}}`, path[key].join('/'));
8
+ }
9
+ else {
10
+ pathname = pathname.replace(`{${key}}`, String(path[key]));
11
+ }
9
12
  }
10
13
  const searchParams = new URLSearchParams();
11
14
  for (const key in query) {
12
- const paramValue = query[key];
13
- if (typeof paramValue === 'string' && paramValue.length > 0)
14
- searchParams.append(key, paramValue);
15
- else if (typeof paramValue === 'number')
16
- searchParams.append(key, paramValue.toString());
15
+ if (query[key] === '')
16
+ continue;
17
+ if (Array.isArray(query[key])) {
18
+ for (const value of query[key]) {
19
+ searchParams.append(key, String(value));
20
+ }
21
+ }
22
+ else {
23
+ searchParams.set(key, String(query[key]));
24
+ }
17
25
  }
18
26
  return searchParams.size > 0 ? `${pathname}?${searchParams}` : pathname;
19
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "8.1.0",
3
+ "version": "8.1.2",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "dependencies": {
47
47
  "@fumari/json-schema-to-typescript": "^1.1.3",
48
- "@radix-ui/react-dialog": "^1.1.10",
48
+ "@radix-ui/react-dialog": "^1.1.11",
49
49
  "@radix-ui/react-select": "^2.2.2",
50
50
  "@radix-ui/react-slot": "^1.2.0",
51
51
  "@scalar/openapi-parser": "0.10.16",
@@ -55,21 +55,20 @@
55
55
  "github-slugger": "^2.0.0",
56
56
  "hast-util-to-jsx-runtime": "^2.3.6",
57
57
  "js-yaml": "^4.1.0",
58
- "lucide-react": "^0.503.0",
59
58
  "next-themes": "^0.4.6",
60
59
  "openapi-sampler": "^1.6.1",
61
- "react-hook-form": "^7.56.0",
60
+ "react-hook-form": "^7.56.1",
62
61
  "remark": "^15.0.1",
63
62
  "remark-rehype": "^11.1.2",
64
63
  "shiki": "^3.3.0",
65
64
  "xml-js": "^1.6.11",
66
- "fumadocs-core": "15.2.10",
67
- "fumadocs-ui": "15.2.10"
65
+ "fumadocs-core": "15.2.11",
66
+ "fumadocs-ui": "15.2.11"
68
67
  },
69
68
  "devDependencies": {
70
- "@scalar/api-client-react": "^1.2.23",
69
+ "@scalar/api-client-react": "^1.2.26",
71
70
  "@types/js-yaml": "^4.0.9",
72
- "@types/node": "22.14.1",
71
+ "@types/node": "22.15.2",
73
72
  "@types/openapi-sampler": "^1.0.3",
74
73
  "@types/react": "^19.1.2",
75
74
  "next": "15.3.1",