fumadocs-openapi 12.6.9 → 12.6.11

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.
Files changed (74) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/_virtual/_rolldown/runtime.js +8 -6
  3. package/dist/generate-file.js +9 -25
  4. package/dist/i18n.d.ts +1 -1
  5. package/dist/index.browser.d.ts +1 -1
  6. package/dist/index.browser.js +1 -1
  7. package/dist/operation.d.ts +1 -1
  8. package/dist/operation.js +16 -9
  9. package/dist/packages/shared-api/dist/auto-anchor/index.js +1 -1
  10. package/dist/packages/shared-api/dist/components/badge.js +1 -1
  11. package/dist/packages/shared-api/dist/components/collapsible.js +1 -1
  12. package/dist/packages/shared-api/dist/components/copy-typescript.js +3 -3
  13. package/dist/packages/shared-api/dist/components/defaults.d.ts +1 -1
  14. package/dist/packages/shared-api/dist/components/defaults.js +1 -1
  15. package/dist/packages/shared-api/dist/components/dialog.js +4 -4
  16. package/dist/packages/shared-api/dist/components/example.js +4 -4
  17. package/dist/packages/shared-api/dist/components/playground/fields.js +11 -11
  18. package/dist/packages/shared-api/dist/components/playground/json-editor.js +1 -1
  19. package/dist/packages/shared-api/dist/components/playground/panels.js +6 -6
  20. package/dist/packages/shared-api/dist/components/playground/param-input.js +1 -1
  21. package/dist/packages/shared-api/dist/components/playground/result.js +3 -3
  22. package/dist/packages/shared-api/dist/components/playground/schema.js +1 -1
  23. package/dist/packages/shared-api/dist/components/playground/server-select.js +5 -5
  24. package/dist/packages/shared-api/dist/components/schema/client.js +11 -6
  25. package/dist/packages/shared-api/dist/components/schema/index.js +2 -2
  26. package/dist/packages/shared-api/dist/components/segmented.js +1 -1
  27. package/dist/packages/shared-api/dist/components/select-tab.js +1 -1
  28. package/dist/packages/shared-api/dist/components/select.js +3 -3
  29. package/dist/packages/shared-api/dist/components/spinner.js +1 -1
  30. package/dist/packages/shared-api/dist/source.js +40 -24
  31. package/dist/packages/shared-api/dist/utils/use-server-store.js +1 -1
  32. package/dist/playground/auth.d.ts +4 -3
  33. package/dist/playground/auth.js +65 -49
  34. package/dist/playground/fetcher.js +1 -1
  35. package/dist/playground/use-playground.d.ts +2 -2
  36. package/dist/playground/use-playground.js +3 -3
  37. package/dist/press.d.ts +2 -2
  38. package/dist/requests/generators/csharp.js +2 -1
  39. package/dist/requests/generators/curl.js +3 -2
  40. package/dist/requests/generators/index.js +1 -1
  41. package/dist/requests/media/adapter.d.ts +2 -0
  42. package/dist/requests/media/adapter.js +6 -4
  43. package/dist/requests/media/encode.js +4 -11
  44. package/dist/requests/string-utils.js +3 -3
  45. package/dist/server/index.d.ts +3 -3
  46. package/dist/server/index.js +37 -32
  47. package/dist/ui/base.d.ts +1 -1
  48. package/dist/ui/components/schema.js +1 -1
  49. package/dist/ui/index.d.ts +1 -1
  50. package/dist/ui/index.js +1 -1
  51. package/dist/ui/operation/index.js +9 -8
  52. package/dist/ui/operation/usage-tabs.js +4 -4
  53. package/dist/ui/playground/client.d.ts +2 -2
  54. package/dist/ui/playground/client.js +7 -7
  55. package/dist/ui/playground/components/auth.js +6 -6
  56. package/dist/ui/playground/components/request-panel.d.ts +2 -2
  57. package/dist/ui/playground/components/request-panel.js +4 -4
  58. package/dist/ui/playground/components/response-panel.js +3 -3
  59. package/dist/ui/playground/components/result-display.d.ts +1 -1
  60. package/dist/ui/playground/components/result-display.js +3 -3
  61. package/dist/ui/playground/components/server-select.js +1 -1
  62. package/dist/ui/scalar/client.js +5 -5
  63. package/dist/utils/create-page.d.ts +3 -3
  64. package/dist/utils/create-page.js +3 -3
  65. package/dist/utils/get-example-requests.js +5 -5
  66. package/dist/utils/pages/builder.js +1 -1
  67. package/dist/utils/pages/preset-auto.js +3 -3
  68. package/dist/utils/pages/to-static-data.d.ts +1 -1
  69. package/dist/utils/pages/to-static-data.js +14 -12
  70. package/dist/utils/pages/to-text.js +1 -1
  71. package/dist/utils/schema.js +6 -3
  72. package/dist/utils/use-server.d.ts +1 -1
  73. package/dist/utils/use-server.js +1 -1
  74. package/package.json +13 -13
@@ -1,4 +1,8 @@
1
1
  "use client";
2
+ import { useState } from "react";
3
+ import { Switch } from "@base-ui/react/switch";
4
+ import { getRaw } from "@scalar/json-magic/magic-proxy";
5
+ import { useTranslations } from "@fuma-translate/react";
2
6
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../packages/shared-api/dist/components/select.js";
3
7
  import { ExampleHeader, ExampleSelect, captionCodeBlock, cardCodeBlock, exampleActions, exampleCardClassName, exampleCodeBlock, selectCodeUsage, useCodeUsageId } from "../../packages/shared-api/dist/components/example.js";
4
8
  import { ClientCodeBlock } from "../components/codeblock.js";
@@ -7,11 +11,7 @@ import { MethodLabel } from "../components/method-label.js";
7
11
  import { useCodeUsage, useExampleRequests, useOperation, useResponseExamples } from "../../operation.js";
8
12
  import { useOpenAPI, useRenderContext } from "../../utils/create-page.js";
9
13
  import { cn } from "../../utils/cn.js";
10
- import { useState } from "react";
11
- import { getRaw } from "@scalar/json-magic/magic-proxy";
12
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
- import { useTranslations } from "@fuma-translate/react";
14
- import { Switch } from "@base-ui/react/switch";
15
15
  // src/ui/operation/usage-tabs.tsx
16
16
  function UsageTabs() {
17
17
  const ctx = useRenderContext();
@@ -1,9 +1,9 @@
1
+ import { ComponentProps, FC, ReactNode } from "react";
1
2
  import { DefaultResultDisplay, ResultDisplayProps } from "./components/result-display.js";
3
+ import { FieldKey } from "@fumari/stf";
2
4
  import { ParameterObject } from "../../types.js";
3
5
  import { PlaygroundOptions, RequestBodyInfo } from "../../playground/use-playground.js";
4
6
  import { ParameterFieldContext } from "./components/request-panel.js";
5
- import { ComponentProps, FC, ReactNode } from "react";
6
- import { FieldKey } from "@fumari/stf";
7
7
  export interface PlaygroundClientProps extends ComponentProps<'div'>, PlaygroundClientOptions {
8
8
  /** @deprecated it defaults to `true` for requests */
9
9
  writeOnly?: boolean;
@@ -1,4 +1,9 @@
1
1
  "use client";
2
+ import { useMemo, useRef, useState } from "react";
3
+ import { flushSync } from "react-dom";
4
+ import { Dialog } from "@base-ui/react/dialog";
5
+ import { X } from "lucide-react";
6
+ import { useOnChange } from "fumadocs-core/utils/use-on-change";
2
7
  import { useOpenAPI } from "../../utils/create-page.js";
3
8
  import { useExampleRequests, useOperation } from "../../operation.js";
4
9
  import { DefaultResultDisplay } from "./components/result-display.js";
@@ -8,19 +13,14 @@ import { DialogPopup, PlaygroundTrigger } from "../../packages/shared-api/dist/c
8
13
  import { cn } from "../../utils/cn.js";
9
14
  import { SchemaProvider } from "../../packages/shared-api/dist/components/playground/schema.js";
10
15
  import { RequestExampleSelect, ViewSwitch, iconButtonClassName } from "../../packages/shared-api/dist/components/playground/panels.js";
16
+ import { StfProvider, useFieldValue } from "@fumari/stf";
17
+ import { useTranslations } from "@fuma-translate/react";
11
18
  import { usePlayground } from "../../playground/use-playground.js";
12
19
  import { UrlBar } from "./components/url-bar.js";
13
20
  import { builtinAuthProviders } from "./components/auth.js";
14
21
  import { RequestPanel } from "./components/request-panel.js";
15
22
  import { ResponsePanel } from "./components/response-panel.js";
16
- import { useMemo, useRef, useState } from "react";
17
23
  import { jsx, jsxs } from "react/jsx-runtime";
18
- import { useTranslations } from "@fuma-translate/react";
19
- import { X } from "lucide-react";
20
- import { flushSync } from "react-dom";
21
- import { Dialog } from "@base-ui/react/dialog";
22
- import { StfProvider, useFieldValue } from "@fumari/stf";
23
- import { useOnChange } from "fumadocs-core/utils/use-on-change";
24
24
  // src/ui/playground/client.tsx
25
25
  function PlaygroundClient({ writeOnly = true, readOnly = false, authProviders, transformAuthInputs, fetchOptions, components, renderParameterField, renderBodyField, ...rest }) {
26
26
  const { doc } = useOpenAPI();
@@ -1,4 +1,10 @@
1
1
  "use client";
2
+ import { Suspense, useEffect, useRef, useState } from "react";
3
+ import { Check, Copy, ExternalLink, ShieldCheck } from "lucide-react";
4
+ import { StfProvider, useDataEngine, useStf } from "@fumari/stf";
5
+ import { useTranslations } from "@fuma-translate/react";
6
+ import { buttonVariants } from "fumadocs-ui/components/ui/button";
7
+ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
2
8
  import { Spinner } from "../../../packages/shared-api/dist/components/spinner.js";
3
9
  import { useQuery } from "../../../packages/shared-api/dist/utils/use-query.js";
4
10
  import { finishOAuthFlow, requestOAuthToken, useAuthRedirect, useOpenIdConnectFlows } from "../../../playground/auth.js";
@@ -8,13 +14,7 @@ import { useServer } from "../../../utils/use-server.js";
8
14
  import { cn } from "../../../utils/cn.js";
9
15
  import { iconButtonClassName } from "../../../packages/shared-api/dist/components/playground/panels.js";
10
16
  import { CheckRow, SelectRow, TextRow, ValueRow } from "../../../packages/shared-api/dist/components/playground/fields.js";
11
- import { Suspense, useEffect, useRef, useState } from "react";
12
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
- import { useTranslations } from "@fuma-translate/react";
14
- import { Check, Copy, ExternalLink, ShieldCheck } from "lucide-react";
15
- import { buttonVariants } from "fumadocs-ui/components/ui/button";
16
- import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
17
- import { StfProvider, useDataEngine, useStf } from "@fumari/stf";
18
18
  // src/ui/playground/components/auth.tsx
19
19
  /** the rows of OAuth and mutual TLS schemes in the built-in UI, after the providers of page */
20
20
  const builtinAuthProviders = [{
@@ -1,7 +1,7 @@
1
- import "../../../playground/use-playground.js";
2
1
  import { ReactNode } from "react";
3
- import { JsonSchema } from "@fumadocs/json-schema";
4
2
  import "@fumari/stf";
3
+ import { JsonSchema } from "@fumadocs/json-schema";
4
+ import "../../../playground/use-playground.js";
5
5
  export interface ParameterFieldContext {
6
6
  /** the default input of parameter, `schema` replaces its schema, like an `enum` of values loaded at runtime */
7
7
  renderDefault: (schema?: JsonSchema) => ReactNode;
@@ -1,4 +1,8 @@
1
1
  "use client";
2
+ import { Fragment, createContext, use, useState } from "react";
3
+ import { Braces, Cookie, KeyRound, PlusIcon, Route, Rows3, SlidersHorizontal } from "lucide-react";
4
+ import { stringifyFieldKey } from "@fumari/stf/lib/utils";
5
+ import { useTranslations } from "@fuma-translate/react";
2
6
  import { anyFields, useResolvedSchema } from "../../../packages/shared-api/dist/components/playground/schema.js";
3
7
  import { FieldRow, FieldRows, LinkRow, ValueRow, getRemoval } from "../../../packages/shared-api/dist/components/playground/fields.js";
4
8
  import { Crumb, FieldPanel, OverviewLayer, Panel, PanelNav, Section, useFieldStack } from "../../../packages/shared-api/dist/components/playground/panels.js";
@@ -7,11 +11,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
7
11
  import { Segmented, SegmentedList } from "../../../packages/shared-api/dist/components/segmented.js";
8
12
  import { useOperation } from "../../../operation.js";
9
13
  import { cn } from "../../../utils/cn.js";
10
- import { Fragment, createContext, use, useState } from "react";
11
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
- import { useTranslations } from "@fuma-translate/react";
13
- import { Braces, Cookie, KeyRound, PlusIcon, Route, Rows3, SlidersHorizontal } from "lucide-react";
14
- import { stringifyFieldKey } from "@fumari/stf/lib/utils";
15
15
  // src/ui/playground/components/request-panel.tsx
16
16
  const sectionIcons = {
17
17
  path: Route,
@@ -1,4 +1,7 @@
1
1
  "use client";
2
+ import { useState } from "react";
3
+ import { SendHorizontal } from "lucide-react";
4
+ import { useTranslations } from "@fuma-translate/react";
2
5
  import { useResponseExamples } from "../../../operation.js";
3
6
  import { ExampleSelect } from "../../../packages/shared-api/dist/components/example.js";
4
7
  import { PanelHeader, Placeholder, SendingOverlay, panelCodeBlock, panelTopCodeBlock } from "../../../packages/shared-api/dist/components/playground/panels.js";
@@ -8,10 +11,7 @@ import { CodeUsages } from "../../operation/usage-tabs.js";
8
11
  import { Markdown } from "../../components/markdown.js";
9
12
  import { cn } from "../../../utils/cn.js";
10
13
  import { DefaultResultDisplay } from "./result-display.js";
11
- import { useState } from "react";
12
14
  import { jsx, jsxs } from "react/jsx-runtime";
13
- import { useTranslations } from "@fuma-translate/react";
14
- import { SendHorizontal } from "lucide-react";
15
15
  // src/ui/playground/components/response-panel.tsx
16
16
  function ResponsePanel({ response, loading, onReset, ResultDisplay = DefaultResultDisplay, className }) {
17
17
  const t = useTranslations({ note: "playground" });
@@ -1,5 +1,5 @@
1
- import { FetchResult } from "../../../playground/fetcher.js";
2
1
  import { ComponentProps } from "react";
2
+ import { FetchResult } from "../../../playground/fetcher.js";
3
3
  export interface ResultDisplayProps extends ComponentProps<'div'> {
4
4
  data: FetchResult;
5
5
  reset: () => void;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
+ import { useCallback, useMemo } from "react";
3
+ import { DownloadIcon, FileIcon } from "lucide-react";
2
4
  import { ClientCodeBlock } from "../../components/codeblock.js";
5
+ import { useTranslations } from "@fuma-translate/react";
3
6
  import { iconButtonClassName, panelCodeBlock } from "../../../packages/shared-api/dist/components/playground/panels.js";
4
7
  import { RequestError, ResponseView } from "../../../packages/shared-api/dist/components/playground/result.js";
5
- import { useCallback, useMemo } from "react";
6
8
  import { jsx, jsxs } from "react/jsx-runtime";
7
- import { useTranslations } from "@fuma-translate/react";
8
- import { DownloadIcon, FileIcon } from "lucide-react";
9
9
  // src/ui/playground/components/result-display.tsx
10
10
  function DefaultResultDisplay({ data, reset, ...rest }) {
11
11
  if (data.type === "client_error") return /* @__PURE__ */ jsx(RequestError, {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
+ import { useTranslations } from "@fuma-translate/react";
2
3
  import { ServerPopover, ServerVariables } from "../../../packages/shared-api/dist/components/playground/server-select.js";
3
4
  import { useServer } from "../../../utils/use-server.js";
4
5
  import { cn } from "../../../utils/cn.js";
5
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { useTranslations } from "@fuma-translate/react";
7
7
  // src/ui/playground/components/server-select.tsx
8
8
  /** the base URL of requests, selects the server and edits its variables */
9
9
  function ServerSelect({ className }) {
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import { MethodLabel } from "../components/method-label.js";
4
- import { useOpenAPI } from "../../utils/create-page.js";
5
- import { useEffect } from "react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { useTranslations } from "@fuma-translate/react";
8
3
  import { buttonVariants } from "fumadocs-ui/components/ui/button";
9
4
  import { useApiClient } from "@scalar/api-client-react";
5
+ import { MethodLabel } from "../components/method-label.js";
10
6
  import { useTheme } from "fumadocs-ui/provider/base";
7
+ import { useEffect } from "react";
8
+ import { useTranslations } from "@fuma-translate/react";
9
+ import { useOpenAPI } from "../../utils/create-page.js";
11
10
  import "@scalar/api-client-react/style.css";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
12
  // src/ui/scalar/client.tsx
13
13
  function ScalarPlayground({ path, method }) {
14
14
  const { resolvedTheme } = useTheme();
@@ -1,16 +1,16 @@
1
1
  import { ExampleRequest, PageOperationProps, ResponseTab } from "../operation.js";
2
+ import { FC, ReactNode } from "react";
2
3
  import { Awaitable, Document, HttpMethods, OperationObject, PathItemObject } from "../types.js";
3
4
  import { OpenAPIPageProps, OperationItem, WebhookItem } from "./pages/builder.js";
4
5
  import { DereferencedDocument } from "./document/dereference.js";
5
6
  import { MediaAdapter } from "../requests/media/adapter.js";
6
7
  import { CodeUsageGeneratorRegistry, InlineCodeUsageGenerator } from "../requests/generators/index.js";
8
+ import { JsonSchema } from "@fumadocs/json-schema";
7
9
  import { SchemaUIOptions } from "../packages/shared-api/dist/components/schema/index.js";
8
10
  import { PlaygroundClientOptions } from "../ui/playground/client.js";
9
- import { PageComponents, ShikiOptions } from "../packages/shared-api/dist/components/defaults.js";
10
- import { FC, ReactNode } from "react";
11
- import { JsonSchema } from "@fumadocs/json-schema";
12
11
  import { ShikiFactory } from "fumadocs-core/highlight/shiki";
13
12
  import { Highlighter } from "fumadocs-core/highlight";
13
+ import { PageComponents, ShikiOptions } from "../packages/shared-api/dist/components/defaults.js";
14
14
  /** components the UI renders through, so a page can replace them */
15
15
  export interface OpenAPIComponents extends PageComponents {
16
16
  SchemaUI: FC<SchemaUIOptions>;
@@ -1,14 +1,14 @@
1
1
  "use client";
2
+ import { createContext, use, useMemo } from "react";
2
3
  import { dereferenceBundledDocument } from "./document/dereference.js";
3
4
  import { defaultAdapters } from "../requests/media/adapter.js";
4
5
  import { createCodeUsageGeneratorRegistry } from "../requests/generators/index.js";
5
6
  import { registerDefault } from "../requests/generators/all.js";
7
+ import { generate } from "@fumari/json-schema-ts";
8
+ import { getRaw } from "@scalar/json-magic/magic-proxy";
6
9
  import { createDocumentCache } from "../packages/shared-api/dist/utils/document-cache.js";
7
10
  import { createPageComponents, defaultShikiOptions, resolveHighlighter } from "../packages/shared-api/dist/components/defaults.js";
8
11
  import { ServerProvider } from "./use-server.js";
9
- import { createContext, use, useMemo } from "react";
10
- import { getRaw } from "@scalar/json-magic/magic-proxy";
11
- import { generate } from "@fumari/json-schema-ts";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  // src/utils/create-page.tsx
14
14
  const OpenAPIContext = createContext(null);
@@ -1,9 +1,9 @@
1
1
  import { encodeRequestData } from "../requests/media/encode.js";
2
2
  import { getExampleValue, getPreferredType, pickExample } from "./schema.js";
3
- import { getRaw } from "@scalar/json-magic/magic-proxy";
4
3
  import { dereference, sample } from "@fumadocs/json-schema";
4
+ import { getRaw } from "@scalar/json-magic/magic-proxy";
5
5
  // src/utils/get-example-requests.ts
6
- function getExampleRequests({ path, method, mediaAdapters, requestBody, parameters }) {
6
+ function getExampleRequests({ path, method, mediaAdapters, requestBody, parameters, auth = (data) => data }) {
7
7
  const media = requestBody?.content ? getPreferredType(requestBody.content) : null;
8
8
  const bodyOfType = media ? dereference(requestBody.content[media]) : null;
9
9
  if (bodyOfType?.examples) {
@@ -22,7 +22,7 @@ function getExampleRequests({ path, method, mediaAdapters, requestBody, paramete
22
22
  name: summary || key,
23
23
  description,
24
24
  data,
25
- encoded: encodeRequestData(data, mediaAdapters, parameters)
25
+ encoded: encodeRequestData(auth(data), mediaAdapters, parameters)
26
26
  });
27
27
  }
28
28
  if (result.length > 0) return result;
@@ -39,7 +39,7 @@ function getExampleRequests({ path, method, mediaAdapters, requestBody, paramete
39
39
  name: "Default",
40
40
  description: typeof schema === "object" ? schema.description : void 0,
41
41
  data,
42
- encoded: encodeRequestData(data, mediaAdapters, parameters)
42
+ encoded: encodeRequestData(auth(data), mediaAdapters, parameters)
43
43
  }];
44
44
  }
45
45
  function getRequestData({ method, path, parameters, sampleKey, body }) {
@@ -81,7 +81,7 @@ function getRequestData({ method, path, parameters, sampleKey, body }) {
81
81
  result.bodyMediaType = type;
82
82
  const bodyOfType = dereference(body.content[type]);
83
83
  if (bodyOfType.examples && sampleKey !== void 0) result.body = getExampleValue(dereference(bodyOfType.examples[sampleKey]));
84
- else if (bodyOfType.example) result.body = getRaw(bodyOfType.example);
84
+ else if (bodyOfType.example !== void 0) result.body = getRaw(bodyOfType.example);
85
85
  else result.body = sample(bodyOfType?.schema ?? {}, {
86
86
  skipReadOnly: true,
87
87
  skipNonRequired: true
@@ -1,7 +1,7 @@
1
1
  import { getTagDisplayName, methodKeys } from "../schema.js";
2
2
  import { idToTitle } from "../../packages/shared-api/dist/utils/id-to-title.js";
3
- import { dereferenceBundledDocument } from "../document/dereference.js";
4
3
  import { dereference } from "@fumadocs/json-schema";
4
+ import { dereferenceBundledDocument } from "../document/dereference.js";
5
5
  // src/utils/pages/builder.ts
6
6
  function fromSchema(schemaId, bundled, config) {
7
7
  const files = [];
@@ -1,6 +1,6 @@
1
- import { getTagDisplayName } from "../schema.js";
2
- import { dereference } from "@fumadocs/json-schema";
3
1
  import * as path from "node:path";
2
+ import { dereference } from "@fumadocs/json-schema";
3
+ import { getTagDisplayName } from "../schema.js";
4
4
  // src/utils/pages/preset-auto.ts
5
5
  function createAutoPreset(options) {
6
6
  if (options.per === "custom") return options;
@@ -18,7 +18,7 @@ function createAutoPreset(options) {
18
18
  return schemaId.startsWith("http://") || schemaId.startsWith("https://") ? "index" : path.basename(schemaId, path.extname(schemaId));
19
19
  }
20
20
  if (result.type === "operation") {
21
- const operation = this.document.paths[result.item.path][result.item.method];
21
+ const operation = dereference(this.document.paths[result.item.path])[result.item.method];
22
22
  if (algorithm === "v2" && operation.operationId) return operation.operationId;
23
23
  return path.join(this.routePathToFilePath(result.item.path), result.item.method.toLowerCase());
24
24
  }
@@ -1,6 +1,6 @@
1
- import "./builder.js";
2
1
  import "fumadocs-core/toc";
3
2
  import "fumadocs-core/mdx-plugins";
3
+ import "./builder.js";
4
4
  /** the `_openapi` data of pages */
5
5
  export interface InternalOpenAPIMeta {
6
6
  method?: string;
@@ -1,7 +1,7 @@
1
- import { idToTitle } from "../../packages/shared-api/dist/utils/id-to-title.js";
2
- import { dereferenceBundledDocument } from "../document/dereference.js";
3
- import { dereference } from "@fumadocs/json-schema";
4
1
  import Slugger from "github-slugger";
2
+ import { dereference } from "@fumadocs/json-schema";
3
+ import { dereferenceBundledDocument } from "../document/dereference.js";
4
+ import { getOperationTitle } from "../schema.js";
5
5
  // src/utils/pages/to-static-data.ts
6
6
  function toStaticData(page, doc) {
7
7
  const proxied = dereferenceBundledDocument(doc).dereferenced;
@@ -11,9 +11,9 @@ function toStaticData(page, doc) {
11
11
  headings: [],
12
12
  contents: []
13
13
  };
14
- function pathItem(item, defaultTitle) {
15
- if (page.showTitle && item.operationId) {
16
- const title = item.summary || (item.operationId ? idToTitle(item.operationId) : defaultTitle);
14
+ function addOperation(item, pathItem, path) {
15
+ if (page.showTitle) {
16
+ const title = getOperationTitle(item, pathItem, path);
17
17
  const id = slugger.slug(title);
18
18
  toc.push({
19
19
  depth: 2,
@@ -31,14 +31,16 @@ function toStaticData(page, doc) {
31
31
  });
32
32
  }
33
33
  for (const item of page.operations ?? []) {
34
- const operation = dereference(proxied.paths?.[item.path])?.[item.method];
35
- if (!operation) continue;
36
- pathItem(operation, item.path);
34
+ const pathItem = dereference(proxied.paths?.[item.path]);
35
+ const operation = pathItem?.[item.method];
36
+ if (!pathItem || !operation) continue;
37
+ addOperation(operation, pathItem, item.path);
37
38
  }
38
39
  for (const item of page.webhooks ?? []) {
39
- const webhook = dereference(proxied.webhooks?.[item.name])?.[item.method];
40
- if (!webhook) continue;
41
- pathItem(webhook, item.name);
40
+ const pathItem = dereference(proxied.webhooks?.[item.name]);
41
+ const operation = pathItem?.[item.method];
42
+ if (!pathItem || !operation) continue;
43
+ addOperation(operation, pathItem, `/${item.name}`);
42
44
  }
43
45
  return {
44
46
  toc,
@@ -1,7 +1,7 @@
1
+ import { stringify } from "yaml";
1
2
  import { getPageProps } from "./builder.js";
2
3
  import { toStaticData } from "./to-static-data.js";
3
4
  import { doubleQuote, jsxString } from "../../requests/string-utils.js";
4
- import { stringify } from "yaml";
5
5
  // src/utils/pages/to-text.ts
6
6
  function toText(entry, doc, options = {}) {
7
7
  const { frontmatter, includeDescription = false } = options;
@@ -1,6 +1,6 @@
1
1
  import { idToTitle } from "../packages/shared-api/dist/utils/id-to-title.js";
2
- import { getRaw } from "@scalar/json-magic/magic-proxy";
3
2
  import { dereference } from "@fumadocs/json-schema";
3
+ import { getRaw } from "@scalar/json-magic/magic-proxy";
4
4
  // src/utils/schema.ts
5
5
  /** the operation fields of a Path Item, in the order of pages */
6
6
  const methodKeys = [
@@ -23,6 +23,9 @@ function getTagDisplayName(tag) {
23
23
  if (tag.summary) return tag.summary;
24
24
  return idToTitle(tag.name);
25
25
  }
26
+ function getOperationTitle(operation, pathItem, path) {
27
+ return operation.summary || pathItem.summary || (operation.operationId ? idToTitle(operation.operationId) : path);
28
+ }
26
29
  function pickExample(value) {
27
30
  if (value.example !== void 0) return getRaw(value.example);
28
31
  if (value.content) {
@@ -41,6 +44,6 @@ function pickExample(value) {
41
44
  }
42
45
  /** the value of an Example Object, `dataValue` since OpenAPI 3.2 */
43
46
  function getExampleValue(example) {
44
- return getRaw(example.dataValue ?? example.value);
47
+ return getRaw(example.dataValue !== void 0 ? example.dataValue : example.value);
45
48
  }
46
- export { getExampleValue, getPreferredType, getTagDisplayName, methodKeys, pickExample };
49
+ export { getExampleValue, getOperationTitle, getPreferredType, getTagDisplayName, methodKeys, pickExample };
@@ -1,5 +1,5 @@
1
- import { ServerObject } from "../types.js";
2
1
  import "react";
2
+ import { ServerObject } from "../types.js";
3
3
  export interface SelectedServer {
4
4
  url: string;
5
5
  name?: string;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
+ import { createContext, use, useCallback, useMemo, useSyncExternalStore } from "react";
2
3
  import { useServerStore } from "../packages/shared-api/dist/utils/use-server-store.js";
3
4
  import { joinURL, resolveServerUrl } from "../packages/shared-api/dist/utils/url.js";
4
- import { createContext, use, useCallback, useMemo, useSyncExternalStore } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  // src/utils/use-server.tsx
7
7
  const ServerContext = createContext(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "12.6.9",
3
+ "version": "12.6.11",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -56,36 +56,36 @@
56
56
  "dependencies": {
57
57
  "@base-ui/react": "^1.9.0",
58
58
  "@fuma-translate/react": "^1.0.2",
59
- "@fumadocs/json-schema": "^0.3.6",
59
+ "@fumadocs/json-schema": "^0.3.8",
60
60
  "@fumari/json-schema-ts": "^1.0.2",
61
61
  "@fumari/stf": "^1.1.2",
62
- "@scalar/json-magic": "^0.19.0",
63
- "@scalar/openapi-upgrader": "^0.4.8",
62
+ "@scalar/json-magic": "^0.24.1",
63
+ "@scalar/openapi-upgrader": "^0.5.5",
64
64
  "chokidar": "^6.0.0",
65
65
  "class-variance-authority": "^0.7.1",
66
66
  "cn": "^0.5.2",
67
67
  "github-slugger": "^2.0.0",
68
- "lucide-react": "^1.71.0",
68
+ "lucide-react": "^1.87.0",
69
69
  "remark": "^15.0.1",
70
70
  "remark-rehype": "^11.1.2",
71
71
  "shiki": "^4.6.0",
72
- "undici": "^8.12.4",
72
+ "undici": "^8.14.0",
73
73
  "yaml": "^2.9.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@scalar/api-client-react": "^2.0.65",
76
+ "@scalar/api-client-react": "^2.0.77",
77
77
  "@tailwindcss/oxide": "^4.3.5",
78
- "@types/node": "26.6.6",
79
- "@types/react": "^19.3.0",
78
+ "@types/node": "26.6.11",
79
+ "@types/react": "^19.3.3",
80
80
  "@types/react-dom": "^19.3.0",
81
81
  "fast-content-type-parse": "^4.0.1",
82
82
  "fuma-cli": "^0.3.4",
83
- "fumadocs-core": "16.19.9",
84
- "fumadocs-ui": "npm:@fumadocs/base-ui@16.19.9",
83
+ "fumadocs-core": "16.19.11",
84
+ "fumadocs-ui": "npm:@fumadocs/base-ui@16.19.11",
85
85
  "json-schema-typed": "^9.0.0",
86
- "shared-api": "0.2.17",
86
+ "shared-api": "0.2.19",
87
87
  "tsconfig": "0.0.0",
88
- "tsdown": "0.23.7",
88
+ "tsdown": "0.23.8",
89
89
  "xml-js": "^1.6.11"
90
90
  },
91
91
  "peerDependencies": {