fumadocs-openapi 10.2.1 → 10.2.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,9 +1,10 @@
|
|
|
1
|
-
import type { LoaderPlugin,
|
|
1
|
+
import type { LoaderPlugin, PageData, PageTreeTransformer, Source } from 'fumadocs-core/source';
|
|
2
2
|
import type { OpenAPIServer } from '../server/create.js';
|
|
3
3
|
import type { SchemaToPagesOptions } from '../utils/pages/preset-auto.js';
|
|
4
4
|
import type { ApiPageProps } from '../ui/api-page.js';
|
|
5
5
|
import type { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import type { TOCItemType } from 'fumadocs-core/toc';
|
|
7
|
+
import type { ProcessedDocument } from '../utils/process-document.js';
|
|
7
8
|
declare module 'fumadocs-core/source' {
|
|
8
9
|
interface PageData {
|
|
9
10
|
/**
|
|
@@ -22,6 +23,9 @@ export interface InternalOpenAPIMeta {
|
|
|
22
23
|
export declare function openapiPlugin(): LoaderPlugin;
|
|
23
24
|
interface OpenAPIPageData extends PageData {
|
|
24
25
|
getAPIPageProps: () => ApiPageProps;
|
|
26
|
+
getSchema: () => {
|
|
27
|
+
id: string;
|
|
28
|
+
} & ProcessedDocument;
|
|
25
29
|
structuredData: StructuredData;
|
|
26
30
|
toc: TOCItemType[];
|
|
27
31
|
}
|
|
@@ -31,7 +35,7 @@ interface OpenAPIPageData extends PageData {
|
|
|
31
35
|
export declare function openapiSource(server: OpenAPIServer, options?: SchemaToPagesOptions & {
|
|
32
36
|
baseDir?: string;
|
|
33
37
|
}): Promise<Source<{
|
|
34
|
-
metaData:
|
|
38
|
+
metaData: never;
|
|
35
39
|
pageData: OpenAPIPageData;
|
|
36
40
|
}>>;
|
|
37
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-api.d.ts","sourceRoot":"","sources":["../../src/server/source-api.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,Y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AQ,EAAE,eAAe,CAAC;CAC3B,CAAC,CACH,CAgDA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,CAExD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MethodLabel } from '../ui/components/method-label.js';
|
|
3
|
-
import { toStaticData } from '../utils/pages/to-static-data.js';
|
|
4
3
|
/**
|
|
5
4
|
* Fumadocs Source API integration, pass this to `plugins` array in `loader()`.
|
|
6
5
|
*/
|
|
@@ -37,10 +36,11 @@ export async function openapiSource(server, options = {}) {
|
|
|
37
36
|
const { createAutoPreset } = await import('../utils/pages/preset-auto.js');
|
|
38
37
|
const { fromServer } = await import('../utils/pages/builder.js');
|
|
39
38
|
const { toBody } = await import('../utils/pages/to-body.js');
|
|
39
|
+
const { toStaticData } = await import('../utils/pages/to-static-data.js');
|
|
40
40
|
const files = [];
|
|
41
41
|
const entries = await fromServer(server, createAutoPreset(options));
|
|
42
42
|
for (const [schemaId, list] of Object.entries(entries)) {
|
|
43
|
-
const
|
|
43
|
+
const processed = await server.getSchema(schemaId);
|
|
44
44
|
for (const entry of list) {
|
|
45
45
|
const props = toBody(entry);
|
|
46
46
|
props.showDescription ?? (props.showDescription = true);
|
|
@@ -52,7 +52,13 @@ export async function openapiSource(server, options = {}) {
|
|
|
52
52
|
getAPIPageProps() {
|
|
53
53
|
return props;
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
getSchema() {
|
|
56
|
+
return {
|
|
57
|
+
id: schemaId,
|
|
58
|
+
...processed,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
...toStaticData(props, processed.dereferenced),
|
|
56
62
|
_openapi: {
|
|
57
63
|
method: entry.type === 'operation' || entry.type === 'webhook'
|
|
58
64
|
? entry.item.method
|
|
@@ -8,7 +8,7 @@ export type ProcessedDocument = {
|
|
|
8
8
|
dereferenced: NoReference<Document>;
|
|
9
9
|
_internal_idToSchema: () => Map<string, object>;
|
|
10
10
|
/**
|
|
11
|
-
* Get raw object from
|
|
11
|
+
* Get raw object from dereferenced object
|
|
12
12
|
*/
|
|
13
13
|
getRawRef: (obj: object) => string | undefined;
|
|
14
14
|
bundled: Document;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.2",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"js-yaml": "^4.1.1",
|
|
64
64
|
"next-themes": "^0.4.6",
|
|
65
65
|
"openapi-sampler": "^1.6.2",
|
|
66
|
-
"react-hook-form": "^7.
|
|
66
|
+
"react-hook-form": "^7.69.0",
|
|
67
67
|
"remark": "^15.0.1",
|
|
68
68
|
"remark-rehype": "^11.1.2",
|
|
69
69
|
"tailwind-merge": "^3.4.0",
|
|
70
70
|
"xml-js": "^1.6.11"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@scalar/api-client-react": "^1.3.
|
|
73
|
+
"@scalar/api-client-react": "^1.3.59",
|
|
74
74
|
"@types/js-yaml": "^4.0.9",
|
|
75
75
|
"@types/node": "24.10.2",
|
|
76
76
|
"@types/openapi-sampler": "^1.0.3",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"tailwindcss": "^4.1.18",
|
|
81
81
|
"tsc-alias": "^1.8.16",
|
|
82
82
|
"eslint-config-custom": "0.0.0",
|
|
83
|
-
"fumadocs-
|
|
84
|
-
"fumadocs-
|
|
83
|
+
"fumadocs-core": "16.4.0",
|
|
84
|
+
"fumadocs-ui": "16.4.0",
|
|
85
85
|
"tsconfig": "0.0.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|