fumadocs-openapi 10.9.0 → 10.9.1

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.
@@ -45,6 +45,7 @@
45
45
  @source inline("all");
46
46
  @source inline("allFlows");
47
47
  @source inline("allOf");
48
+ @source inline("allow");
48
49
  @source inline("already");
49
50
  @source inline("alt");
50
51
  @source inline("and");
@@ -120,6 +121,8 @@
120
121
  @source inline("both");
121
122
  @source inline("boundary");
122
123
  @source inline("buffer");
124
+ @source inline("builderOptions");
125
+ @source inline("built-in");
123
126
  @source inline("bundled");
124
127
  @source inline("but");
125
128
  @source inline("button");
@@ -221,7 +224,6 @@
221
224
  @source inline("data-placeholder:text-fd-muted-foreground");
222
225
  @source inline("data-type");
223
226
  @source inline("dataEngine");
224
- @source inline("declare");
225
227
  @source inline("default");
226
228
  @source inline("defaultAdapters");
227
229
  @source inline("defaultColor");
@@ -351,7 +353,7 @@
351
353
  @source inline("forwardRef");
352
354
  @source inline("found");
353
355
  @source inline("from");
354
- @source inline("fromServer");
356
+ @source inline("fromSchema");
355
357
  @source inline("fs");
356
358
  @source inline("full");
357
359
  @source inline("fumadocs-core/i18n");
@@ -547,7 +549,6 @@
547
549
  @source inline("min-w-0");
548
550
  @source inline("missing");
549
551
  @source inline("modify");
550
- @source inline("module");
551
552
  @source inline("moon");
552
553
  @source inline("mounted");
553
554
  @source inline("ms-2");
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MediaAdapter } from "./requests/media/adapter.js";
2
- import { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, fromServer, getPageProps } from "./utils/pages/builder.js";
2
+ import { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, getPageProps } from "./utils/pages/builder.js";
3
3
  import { SchemaToPagesOptions, createAutoPreset } from "./utils/pages/preset-auto.js";
4
4
  import { Awaitable, CallbackObject, DistributiveOmit, Document, ExampleObject, HttpMethods, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject } from "./types.js";
5
5
  import { Config, OutputFile, generateFiles, generateFilesOnly } from "./generate-file.js";
6
- export { Awaitable, CallbackObject, Config, DistributiveOmit, Document, ExampleObject, HttpMethods, type MediaAdapter, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, OperationOutput, OutputEntry, OutputFile, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SchemaToPagesOptions, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject, WebhookOutput, createAutoPreset, fromSchema, fromServer, generateFiles, generateFilesOnly, getPageProps };
6
+ export { Awaitable, CallbackObject, Config, DistributiveOmit, Document, ExampleObject, HttpMethods, type MediaAdapter, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, OperationOutput, OutputEntry, OutputFile, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SchemaToPagesOptions, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject, WebhookOutput, createAutoPreset, fromSchema, generateFiles, generateFilesOnly, getPageProps };
@@ -1,5 +1,5 @@
1
1
  import { traverse } from "../helpers/traverse.js";
2
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js
2
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js
3
3
  const DEFAULT_MEDIA_TYPE = "application/json";
4
4
  /** Extracts and removes x-example and x-examples extensions from an object */
5
5
  function extractXExampleExtensions(obj) {
@@ -1,5 +1,5 @@
1
1
  import { traverse } from "../helpers/traverse.js";
2
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
2
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
3
3
  const SCHEMA_SEGMENTS = new Set([
4
4
  "properties",
5
5
  "items",
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js
1
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js
2
2
  /**
3
3
  * Recursively migrate XML object properties from 3.1 to 3.2 format
4
4
  */
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js
1
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js
2
2
  /**
3
3
  * Recursively traverses the content and applies the transform function to each node.
4
4
  */
@@ -1,7 +1,7 @@
1
1
  import { upgradeFromThreeOneToThreeTwo } from "./3.1-to-3.2/upgrade-from-three-one-to-three-two.js";
2
2
  import { upgradeFromTwoToThree } from "./2.0-to-3.0/upgrade-from-two-to-three.js";
3
3
  import { upgradeFromThreeToThreeOne } from "./3.0-to-3.1/upgrade-from-three-to-three-one.js";
4
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/upgrade.js
4
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/upgrade.js
5
5
  function upgrade(value, targetVersion) {
6
6
  const openapi30 = upgradeFromTwoToThree(value);
7
7
  if (targetVersion === "3.0") return openapi30;
@@ -43,7 +43,7 @@ interface OpenAPIServer {
43
43
  pageData: OpenAPIPageData;
44
44
  }>>;
45
45
  /**
46
- * Generate virtual pages for Fumadocs Source API
46
+ * Generate virtual pages for Fumadocs Source API (note: please disable cache to allow built-in revalidation)
47
47
  */
48
48
  dynamicSource: (options?: OpenAPISourceOptions) => DynamicSource<{
49
49
  metaData: MetaData;
@@ -64,6 +64,7 @@ interface OpenAPIPageData extends PageData {
64
64
  getClientAPIPageProps: () => Promise<ClientApiPageProps>;
65
65
  structuredData: StructuredData;
66
66
  toc: TOCItemType[];
67
+ _openapi?: InternalOpenAPIMeta;
67
68
  }
68
69
  type OpenAPISourceOptions = SchemaToPagesOptions & {
69
70
  baseDir?: string; /** Generate `meta.json` files */
@@ -76,14 +77,6 @@ declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
76
77
  * @deprecated
77
78
  */
78
79
  declare function createCodeSample<T>(options: InlineCodeUsageGenerator<T>): InlineCodeUsageGenerator<T>;
79
- declare module 'fumadocs-core/source' {
80
- interface PageData {
81
- /**
82
- * Added by Fumadocs OpenAPI
83
- */
84
- _openapi?: InternalOpenAPIMeta;
85
- }
86
- }
87
80
  interface InternalOpenAPIMeta {
88
81
  method?: string;
89
82
  webhook?: boolean;
@@ -23,11 +23,12 @@ function createOpenAPI(options = {}) {
23
23
  async function getVirtualFiles(server, options) {
24
24
  const { baseDir = "", meta = false } = options;
25
25
  const { createAutoPreset } = await import("../utils/pages/preset-auto.js");
26
- const { fromServer } = await import("../utils/pages/builder.js");
26
+ const { fromSchema } = await import("../utils/pages/builder.js");
27
27
  const files = [];
28
- const entries = await fromServer(server, createAutoPreset(options));
29
- for (const [schemaId, list] of Object.entries(entries)) {
30
- const processed = await server.getSchema(schemaId);
28
+ const schemas = await server.getSchemas();
29
+ const builderOptions = createAutoPreset(options);
30
+ for (const [id, schema] of Object.entries(schemas)) {
31
+ onEntries(fromSchema(id, schema, builderOptions));
31
32
  function onEntry(entry) {
32
33
  const props = getPageProps(entry);
33
34
  files.push({
@@ -41,7 +42,7 @@ function createOpenAPI(options = {}) {
41
42
  async getClientAPIPageProps() {
42
43
  return {
43
44
  payload: {
44
- bundled: processed.bundled,
45
+ bundled: schema.bundled,
45
46
  proxyUrl: server.options.proxyUrl
46
47
  },
47
48
  ...props
@@ -49,11 +50,11 @@ function createOpenAPI(options = {}) {
49
50
  },
50
51
  getSchema() {
51
52
  return {
52
- id: schemaId,
53
- ...processed
53
+ id,
54
+ ...schema
54
55
  };
55
56
  },
56
- ...toStaticData(props, processed.dereferenced),
57
+ ...toStaticData(props, schema.dereferenced),
57
58
  _openapi: {
58
59
  method: entry.type === "operation" || entry.type === "webhook" ? entry.item.method : void 0,
59
60
  webhook: entry.type === "webhook",
@@ -92,7 +93,6 @@ function createOpenAPI(options = {}) {
92
93
  }
93
94
  });
94
95
  }
95
- onEntries(list);
96
96
  }
97
97
  return files;
98
98
  }
@@ -1,5 +1,5 @@
1
1
  import { bundle } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js";
2
- import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
2
+ import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
3
3
  import { fetchUrls } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js";
4
4
  import { readFiles } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js";
5
5
  import "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js";
@@ -1,5 +1,4 @@
1
1
  import { ApiPageProps, OperationItem, WebhookItem } from "../../ui/api-page.js";
2
- import { OpenAPIServer } from "../../server/index.js";
3
2
  import { OperationObject, PathItemObject, TagObject } from "../../types.js";
4
3
  import { NoReference } from "../schema/index.js";
5
4
  import { DereferencedDocument } from "../document/dereference.js";
@@ -83,8 +82,7 @@ interface ExtractedInfo {
83
82
  tags?: string[];
84
83
  })[];
85
84
  }
86
- declare function fromServer(server: OpenAPIServer, config: PagesBuilderConfig): Promise<Record<string, OutputEntry[]>>;
87
85
  declare function fromSchema(schemaId: string, processed: DereferencedDocument, config: PagesBuilderConfig): OutputEntry[];
88
86
  declare function getPageProps(entry: PageOutput | OperationOutput | WebhookOutput): ApiPageProps;
89
87
  //#endregion
90
- export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, fromServer, getPageProps };
88
+ export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, getPageProps };
@@ -1,14 +1,6 @@
1
1
  import { idToTitle } from "../id-to-title.js";
2
2
  import { getTagDisplayName, methodKeys } from "../schema/index.js";
3
3
  //#region src/utils/pages/builder.ts
4
- async function fromServer(server, config) {
5
- const schemas = await server.getSchemas();
6
- const generated = {};
7
- const entries = Object.entries(schemas);
8
- if (entries.length === 0) throw new Error("No input files found.");
9
- for (const [id, schema] of entries) generated[id] = fromSchema(id, schema, config);
10
- return generated;
11
- }
12
4
  function fromSchema(schemaId, processed, config) {
13
5
  const files = [];
14
6
  const { toPages } = config;
@@ -117,4 +109,4 @@ function getPageProps(entry) {
117
109
  };
118
110
  }
119
111
  //#endregion
120
- export { fromSchema, fromServer, getPageProps };
112
+ export { fromSchema, getPageProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.9.0",
3
+ "version": "10.9.1",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -53,27 +53,27 @@
53
53
  "lucide-react": "^1.16.0",
54
54
  "remark": "^15.0.1",
55
55
  "remark-rehype": "^11.1.2",
56
- "shiki": "^4.0.2",
56
+ "shiki": "^4.1.0",
57
57
  "tailwind-merge": "^3.6.0",
58
58
  "@fumari/stf": "1.0.5"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@fastify/deepmerge": "^3.2.1",
62
- "@scalar/api-client-react": "2.0.1",
62
+ "@scalar/api-client-react": "2.0.20",
63
63
  "@scalar/json-magic": "^0.12.14",
64
- "@scalar/openapi-upgrader": "^0.2.7",
64
+ "@scalar/openapi-upgrader": "^0.2.8",
65
65
  "@tailwindcss/oxide": "^4.3.0",
66
66
  "@types/js-yaml": "^4.0.9",
67
- "@types/node": "25.8.0",
68
- "@types/react": "^19.2.14",
67
+ "@types/node": "25.9.1",
68
+ "@types/react": "^19.2.15",
69
69
  "ajv": "^8.20.0",
70
70
  "fast-content-type-parse": "^3.0.0",
71
71
  "json-schema-typed": "^8.0.2",
72
72
  "tailwindcss": "^4.3.0",
73
73
  "tsdown": "0.22.0",
74
74
  "xml-js": "^1.6.11",
75
- "fumadocs-core": "16.9.0",
76
- "fumadocs-ui": "16.9.0",
75
+ "fumadocs-core": "16.9.2",
76
+ "fumadocs-ui": "16.9.2",
77
77
  "tsconfig": "0.0.0"
78
78
  },
79
79
  "peerDependencies": {
@@ -100,7 +100,7 @@
100
100
  "@fastify/deepmerge": "3.2.1",
101
101
  "@scalar/helpers": "0.8.0",
102
102
  "@scalar/json-magic": "0.12.14",
103
- "@scalar/openapi-upgrader": "0.2.7",
103
+ "@scalar/openapi-upgrader": "0.2.8",
104
104
  "ajv": "8.20.0",
105
105
  "fast-content-type-parse": "3.0.0",
106
106
  "fast-deep-equal": "3.1.3",