fumadocs-openapi 9.1.12 → 9.2.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.
- package/dist/generate-file.d.ts +3 -2
- package/dist/generate-file.d.ts.map +1 -1
- package/dist/generate-file.js +30 -35
- package/dist/generate.d.ts +5 -4
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +7 -7
- package/dist/render/api-page.d.ts +5 -14
- package/dist/render/api-page.d.ts.map +1 -1
- package/dist/render/api-page.js +4 -2
- package/dist/server/create.d.ts +62 -1
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/create.js +27 -2
- package/dist/types.d.ts +2 -33
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/generate-document.d.ts +2 -2
- package/dist/utils/generate-document.d.ts.map +1 -1
- package/dist/utils/generate-document.js +2 -2
- package/dist/utils/process-document.d.ts +1 -2
- package/dist/utils/process-document.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/generate-file.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type GenerateOptions, type GeneratePageOutput, type GenerateTagOutput } from './generate.js';
|
|
2
2
|
import { type ProcessedDocument } from './utils/process-document.js';
|
|
3
|
+
import type { OpenAPIServer } from './server/index.js';
|
|
3
4
|
interface GenerateFileOutput {
|
|
4
5
|
/**
|
|
5
6
|
* The original schema file path/url from `input`
|
|
@@ -60,9 +61,9 @@ interface BaseName {
|
|
|
60
61
|
}
|
|
61
62
|
interface BaseConfig extends GenerateOptions {
|
|
62
63
|
/**
|
|
63
|
-
* Schema files
|
|
64
|
+
* Schema files, or the OpenAPI server object
|
|
64
65
|
*/
|
|
65
|
-
input: string[] | string;
|
|
66
|
+
input: string[] | string | OpenAPIServer;
|
|
66
67
|
/**
|
|
67
68
|
* Output directory
|
|
68
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-file.d.ts","sourceRoot":"","sources":["../src/generate-file.ts"],"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,CAAC;AAE9D,UAAU,QAAQ;IAChB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB;AAED,UAAU,UAAW,SAAQ,eAAe;IAC1C;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,aAAa,CAAC;IAEzC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqClE"}
|
package/dist/generate-file.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
3
|
import { glob } from 'tinyglobby';
|
|
5
4
|
import { generateAll, generatePages, generateTags, } from './generate.js';
|
|
6
5
|
import { processDocument, } from './utils/process-document.js';
|
|
7
6
|
export async function generateFiles(options) {
|
|
8
|
-
const {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const { cwd = process.cwd() } = options;
|
|
8
|
+
const input = typeof options.input === 'string' ? [options.input] : options.input;
|
|
9
|
+
let schemas = {};
|
|
10
|
+
if (Array.isArray(input)) {
|
|
11
|
+
const targets = [];
|
|
12
|
+
for (const item of input) {
|
|
13
|
+
if (isUrl(item)) {
|
|
14
|
+
targets.push(item);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
targets.push(...(await glob(item, { cwd, absolute: true })));
|
|
18
|
+
}
|
|
17
19
|
}
|
|
20
|
+
await Promise.all(targets.map(async (item) => {
|
|
21
|
+
schemas[item] = await processDocument(item);
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
schemas = await input.getSchemas();
|
|
18
26
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
];
|
|
23
|
-
if (resolvedInputs.length === 0) {
|
|
24
|
-
throw new Error(`No input files found. Tried resolving: ${typeof input === 'string' ? input : input.join(', ')}`);
|
|
27
|
+
const resolvedSchemas = Object.entries(schemas);
|
|
28
|
+
if (resolvedSchemas.length === 0) {
|
|
29
|
+
throw new Error('No input files found.');
|
|
25
30
|
}
|
|
26
|
-
await Promise.all(
|
|
31
|
+
await Promise.all(resolvedSchemas.map(([id, document]) => generateFromDocument(id, document, options)));
|
|
27
32
|
}
|
|
28
|
-
async function generateFromDocument(
|
|
33
|
+
async function generateFromDocument(schemaId, document, options) {
|
|
29
34
|
const { output, cwd = process.cwd(), slugify = defaultSlugify } = options;
|
|
35
|
+
const outputDir = path.join(cwd, output);
|
|
30
36
|
let nameFn;
|
|
31
37
|
if (!options.name || typeof options.name !== 'function') {
|
|
32
38
|
const { algorithm = 'v2' } = options.name ?? {};
|
|
@@ -36,9 +42,9 @@ async function generateFromDocument(pathOrUrl, options) {
|
|
|
36
42
|
return slugify(result.tag);
|
|
37
43
|
}
|
|
38
44
|
if (options.per === 'file') {
|
|
39
|
-
return isUrl(
|
|
45
|
+
return isUrl(schemaId)
|
|
40
46
|
? 'index'
|
|
41
|
-
: path.basename(
|
|
47
|
+
: path.basename(schemaId, path.extname(schemaId));
|
|
42
48
|
}
|
|
43
49
|
const result = output;
|
|
44
50
|
if (result.type === 'operation') {
|
|
@@ -58,8 +64,6 @@ async function generateFromDocument(pathOrUrl, options) {
|
|
|
58
64
|
else {
|
|
59
65
|
nameFn = options.name;
|
|
60
66
|
}
|
|
61
|
-
const document = await dereference(pathOrUrl, options);
|
|
62
|
-
const outputDir = path.join(cwd, output);
|
|
63
67
|
async function write(file, content) {
|
|
64
68
|
await mkdir(path.dirname(file), { recursive: true });
|
|
65
69
|
await writeFile(file, content);
|
|
@@ -86,9 +90,9 @@ async function generateFromDocument(pathOrUrl, options) {
|
|
|
86
90
|
return [`${file}.mdx`];
|
|
87
91
|
}
|
|
88
92
|
if (options.per === 'file') {
|
|
89
|
-
const result = await generateAll(
|
|
93
|
+
const result = await generateAll(schemaId, document, options);
|
|
90
94
|
const filename = nameFn({
|
|
91
|
-
pathOrUrl,
|
|
95
|
+
pathOrUrl: schemaId,
|
|
92
96
|
content: result,
|
|
93
97
|
}, document.document);
|
|
94
98
|
const outPath = path.join(outputDir, `${filename}.mdx`);
|
|
@@ -96,7 +100,7 @@ async function generateFromDocument(pathOrUrl, options) {
|
|
|
96
100
|
console.log(`Generated: ${outPath}`);
|
|
97
101
|
}
|
|
98
102
|
else if (options.per === 'tag') {
|
|
99
|
-
const results = await generateTags(
|
|
103
|
+
const results = await generateTags(schemaId, document, options);
|
|
100
104
|
for (const result of results) {
|
|
101
105
|
const filename = nameFn(result, document.document);
|
|
102
106
|
const outPath = path.join(outputDir, `${filename}.mdx`);
|
|
@@ -105,7 +109,7 @@ async function generateFromDocument(pathOrUrl, options) {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
else {
|
|
108
|
-
const results = await generatePages(
|
|
112
|
+
const results = await generatePages(schemaId, document, options);
|
|
109
113
|
const mapping = new Map();
|
|
110
114
|
for (const result of results) {
|
|
111
115
|
for (const outputPath of getOutputPaths(options.groupBy, result)) {
|
|
@@ -145,12 +149,3 @@ function getOutputPathFromRoute(path) {
|
|
|
145
149
|
function defaultSlugify(s) {
|
|
146
150
|
return s.replace(/\s+/g, '-').toLowerCase();
|
|
147
151
|
}
|
|
148
|
-
async function dereference(pathOrDocument, options) {
|
|
149
|
-
return processDocument(
|
|
150
|
-
// resolve paths
|
|
151
|
-
typeof pathOrDocument === 'string' &&
|
|
152
|
-
!pathOrDocument.startsWith('http://') &&
|
|
153
|
-
!pathOrDocument.startsWith('https://')
|
|
154
|
-
? resolve(options.cwd ?? process.cwd(), pathOrDocument)
|
|
155
|
-
: pathOrDocument);
|
|
156
|
-
}
|
package/dist/generate.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DocumentContext } from './utils/generate-document.js';
|
|
2
2
|
import type { OperationItem, WebhookItem } from './render/api-page.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProcessedDocument } from './utils/process-document.js';
|
|
4
4
|
export interface GenerateOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Additional imports of your MDX components.
|
|
@@ -36,6 +36,7 @@ export interface GenerateOptions {
|
|
|
36
36
|
/**
|
|
37
37
|
* Inline the entire OpenAPI document into the MDX file.
|
|
38
38
|
*
|
|
39
|
+
* @deprecated Use the new `input` API on `createOpenAPI()` instead.
|
|
39
40
|
* @defaultValue false
|
|
40
41
|
*/
|
|
41
42
|
inlineDocument?: boolean;
|
|
@@ -53,7 +54,7 @@ export type GeneratePageOutput = {
|
|
|
53
54
|
item: WebhookItem;
|
|
54
55
|
content: string;
|
|
55
56
|
};
|
|
56
|
-
export declare function generateAll(
|
|
57
|
-
export declare function generatePages(
|
|
58
|
-
export declare function generateTags(
|
|
57
|
+
export declare function generateAll(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): Promise<string>;
|
|
58
|
+
export declare function generatePages(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): Promise<GeneratePageOutput[]>;
|
|
59
|
+
export declare function generateTags(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): Promise<GenerateTagOutput[]>;
|
|
59
60
|
//# sourceMappingURL=generate.d.ts.map
|
package/dist/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,
|
|
1
|
+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M,CAAC,CAqBjB;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAiE/B;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAwC9B"}
|
package/dist/generate.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getAPIPageItems } from './build-routes.js';
|
|
2
2
|
import { generateDocument, } from './utils/generate-document.js';
|
|
3
3
|
import { idToTitle } from './utils/id-to-title.js';
|
|
4
|
-
export async function generateAll(
|
|
4
|
+
export async function generateAll(schemaId, processed, options = {}) {
|
|
5
5
|
const { document } = processed;
|
|
6
6
|
const items = getAPIPageItems(document);
|
|
7
|
-
return generateDocument(
|
|
7
|
+
return generateDocument(schemaId, processed, {
|
|
8
8
|
operations: items.operations,
|
|
9
9
|
webhooks: items.webhooks,
|
|
10
10
|
hasHead: true,
|
|
@@ -16,7 +16,7 @@ export async function generateAll(input, processed, options = {}) {
|
|
|
16
16
|
type: 'file',
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
export async function generatePages(
|
|
19
|
+
export async function generatePages(schemaId, processed, options = {}) {
|
|
20
20
|
const { document } = processed;
|
|
21
21
|
const items = getAPIPageItems(document);
|
|
22
22
|
const result = [];
|
|
@@ -30,7 +30,7 @@ export async function generatePages(input, processed, options = {}) {
|
|
|
30
30
|
result.push({
|
|
31
31
|
type: 'operation',
|
|
32
32
|
item,
|
|
33
|
-
content: generateDocument(
|
|
33
|
+
content: generateDocument(schemaId, processed, {
|
|
34
34
|
operations: [item],
|
|
35
35
|
hasHead: false,
|
|
36
36
|
}, {
|
|
@@ -54,7 +54,7 @@ export async function generatePages(input, processed, options = {}) {
|
|
|
54
54
|
result.push({
|
|
55
55
|
type: 'webhook',
|
|
56
56
|
item,
|
|
57
|
-
content: generateDocument(
|
|
57
|
+
content: generateDocument(schemaId, processed, {
|
|
58
58
|
webhooks: [item],
|
|
59
59
|
hasHead: false,
|
|
60
60
|
}, {
|
|
@@ -68,7 +68,7 @@ export async function generatePages(input, processed, options = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
return result;
|
|
70
70
|
}
|
|
71
|
-
export async function generateTags(
|
|
71
|
+
export async function generateTags(schemaId, processed, options = {}) {
|
|
72
72
|
const { document } = processed;
|
|
73
73
|
if (!document.tags)
|
|
74
74
|
return [];
|
|
@@ -81,7 +81,7 @@ export async function generateTags(input, processed, options = {}) {
|
|
|
81
81
|
: idToTitle(tag.name);
|
|
82
82
|
return {
|
|
83
83
|
tag: tag.name,
|
|
84
|
-
content: generateDocument(
|
|
84
|
+
content: generateDocument(schemaId, processed, {
|
|
85
85
|
operations,
|
|
86
86
|
webhooks,
|
|
87
87
|
hasHead: true,
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import type { RenderContext } from '../types.js';
|
|
2
|
-
import { type Renderer } from '../render/renderer.js';
|
|
3
2
|
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
4
|
-
import { type
|
|
5
|
-
type
|
|
6
|
-
export interface ApiPageProps extends
|
|
7
|
-
document:
|
|
3
|
+
import { type ProcessedDocument } from '../utils/process-document.js';
|
|
4
|
+
import type { SharedOpenAPIOptions } from '../server/index.js';
|
|
5
|
+
export interface ApiPageProps extends SharedOpenAPIOptions {
|
|
6
|
+
document: Promise<ProcessedDocument> | string | ProcessedDocument;
|
|
8
7
|
hasHead: boolean;
|
|
9
|
-
renderer?: Partial<Renderer>;
|
|
10
8
|
/**
|
|
11
9
|
* An array of operations
|
|
12
10
|
*/
|
|
13
11
|
operations?: OperationItem[];
|
|
14
12
|
webhooks?: WebhookItem[];
|
|
15
|
-
/**
|
|
16
|
-
* By default, it is disabled on dev mode
|
|
17
|
-
*/
|
|
18
|
-
disableCache?: boolean;
|
|
19
13
|
}
|
|
20
14
|
export interface WebhookItem {
|
|
21
15
|
name: string;
|
|
@@ -26,8 +20,5 @@ export interface OperationItem {
|
|
|
26
20
|
method: OpenAPIV3_1.HttpMethods;
|
|
27
21
|
}
|
|
28
22
|
export declare function APIPage(props: ApiPageProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
29
|
-
export declare function getContext(schema: ProcessedDocument, options?:
|
|
30
|
-
renderer?: Partial<Renderer>;
|
|
31
|
-
}): Promise<RenderContext>;
|
|
32
|
-
export {};
|
|
23
|
+
export declare function getContext(schema: ProcessedDocument, options?: SharedOpenAPIOptions): Promise<RenderContext>;
|
|
33
24
|
//# sourceMappingURL=api-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-page.d.ts","sourceRoot":"","sources":["../../src/render/api-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"api-page.d.ts","sourceRoot":"","sources":["../../src/render/api-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAClE,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC;CACjC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,oDAgEhD;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
|
package/dist/render/api-page.js
CHANGED
|
@@ -6,8 +6,10 @@ import { createRenders } from '../render/renderer.js';
|
|
|
6
6
|
import { processDocument, } from '../utils/process-document.js';
|
|
7
7
|
import { defaultAdapters } from '../media/adapter.js';
|
|
8
8
|
export async function APIPage(props) {
|
|
9
|
-
const { operations, hasHead = true, webhooks
|
|
10
|
-
const processed =
|
|
9
|
+
const { operations, hasHead = true, webhooks } = props;
|
|
10
|
+
const processed = typeof props.document === 'string'
|
|
11
|
+
? await processDocument(props.document)
|
|
12
|
+
: await props.document;
|
|
11
13
|
const ctx = await getContext(processed, props);
|
|
12
14
|
const { document } = processed;
|
|
13
15
|
return (_jsxs(ctx.renderer.Root, { ctx: ctx, children: [operations?.map((item) => {
|
package/dist/server/create.d.ts
CHANGED
|
@@ -1,11 +1,72 @@
|
|
|
1
1
|
import type { ApiPageProps } from '../render/api-page.js';
|
|
2
2
|
import { createProxy } from '../server/proxy.js';
|
|
3
3
|
import type { CodeSample } from '../render/operation/index.js';
|
|
4
|
-
|
|
4
|
+
import type { Renderer } from '../render/renderer.js';
|
|
5
|
+
import type { NoReference } from '../utils/schema.js';
|
|
6
|
+
import type { BuiltinTheme, CodeOptionsThemes, CodeToHastOptionsCommon } from 'shiki';
|
|
7
|
+
import type { MediaAdapter } from '../media/adapter.js';
|
|
8
|
+
import type { MethodInformation } from '../types.js';
|
|
9
|
+
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
10
|
+
import { type ProcessedDocument } from '../utils/process-document.js';
|
|
11
|
+
type Awaitable<T> = T | Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* schema id -> downloaded schema object
|
|
14
|
+
*/
|
|
15
|
+
type SchemaMap = Record<string, OpenAPIV3_1.Document | OpenAPIV3.Document>;
|
|
16
|
+
type ProcessedSchemaMap = Record<string, ProcessedDocument>;
|
|
17
|
+
export interface SharedOpenAPIOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The url of proxy to avoid CORS issues
|
|
20
|
+
*/
|
|
21
|
+
proxyUrl?: string;
|
|
22
|
+
renderer?: Partial<Renderer>;
|
|
23
|
+
/**
|
|
24
|
+
* Disable API Playground
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue false
|
|
27
|
+
*/
|
|
28
|
+
disablePlayground?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Generate TypeScript definitions from response schema.
|
|
31
|
+
*
|
|
32
|
+
* Pass `false` to disable it.
|
|
33
|
+
*
|
|
34
|
+
* @param method - the operation object
|
|
35
|
+
* @param statusCode - status code
|
|
36
|
+
*/
|
|
37
|
+
generateTypeScriptSchema?: ((method: NoReference<MethodInformation>, statusCode: string) => Awaitable<string>) | false;
|
|
38
|
+
/**
|
|
39
|
+
* Generate code samples for endpoint.
|
|
40
|
+
*/
|
|
41
|
+
generateCodeSamples?: (method: MethodInformation) => Awaitable<CodeSample[]>;
|
|
42
|
+
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
43
|
+
/**
|
|
44
|
+
* Show full response schema instead of only example response & Typescript definitions
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
showResponseSchema?: boolean;
|
|
49
|
+
mediaAdapters?: Record<string, MediaAdapter>;
|
|
50
|
+
}
|
|
51
|
+
export interface OpenAPIOptions extends SharedOpenAPIOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Schema files, can be:
|
|
54
|
+
* - URL
|
|
55
|
+
* - file path
|
|
56
|
+
* - a function returning records of downloaded schemas.
|
|
57
|
+
*/
|
|
58
|
+
input?: string[] | (() => Promise<SchemaMap>);
|
|
59
|
+
/**
|
|
60
|
+
* By default, it is disabled on dev mode
|
|
61
|
+
*/
|
|
62
|
+
disableCache?: boolean;
|
|
63
|
+
}
|
|
5
64
|
export interface OpenAPIServer {
|
|
6
65
|
getAPIPageProps: (from: ApiPageProps) => ApiPageProps;
|
|
7
66
|
createProxy: typeof createProxy;
|
|
67
|
+
getSchemas: () => Promise<ProcessedSchemaMap>;
|
|
8
68
|
}
|
|
9
69
|
export declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
|
|
10
70
|
export declare function createCodeSample<T>(options: CodeSample<T>): CodeSample;
|
|
71
|
+
export {};
|
|
11
72
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/server/create.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/server/create.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,OAAO,CAAC;AACf,O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B;IAC1D;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,YAAY,CAAC;IACtD,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CA8CzE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAEtE"}
|
package/dist/server/create.js
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
import { createProxy } from '../server/proxy.js';
|
|
2
|
+
import { processDocument, } from '../utils/process-document.js';
|
|
2
3
|
export function createOpenAPI(options = {}) {
|
|
4
|
+
const { input = [], disableCache = process.env.NODE_ENV === 'development', ...shared } = options;
|
|
5
|
+
let schemas;
|
|
6
|
+
async function getSchemas() {
|
|
7
|
+
const out = {};
|
|
8
|
+
if (Array.isArray(input)) {
|
|
9
|
+
await Promise.all(input.map(async (item) => {
|
|
10
|
+
out[item] = await processDocument(item, disableCache);
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
await Promise.all(Object.entries(await input()).map(async ([k, v]) => {
|
|
15
|
+
out[k] = await processDocument(v, disableCache);
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
3
20
|
return {
|
|
4
21
|
createProxy,
|
|
5
|
-
|
|
22
|
+
async getSchemas() {
|
|
23
|
+
return (schemas ?? (schemas = getSchemas()));
|
|
24
|
+
},
|
|
25
|
+
getAPIPageProps({ document, ...props }) {
|
|
6
26
|
return {
|
|
7
|
-
...
|
|
27
|
+
...shared,
|
|
8
28
|
...props,
|
|
29
|
+
document: typeof document === 'string'
|
|
30
|
+
? this.getSchemas().then((map) => {
|
|
31
|
+
return map[document] ?? processDocument(document, disableCache);
|
|
32
|
+
})
|
|
33
|
+
: document,
|
|
9
34
|
};
|
|
10
35
|
},
|
|
11
36
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { OpenAPIV3_1 as V3_1 } from 'openapi-types';
|
|
2
2
|
import type { default as Slugger } from 'github-slugger';
|
|
3
3
|
import { type Renderer } from './render/renderer.js';
|
|
4
|
-
import type { CodeSample } from './render/operation/index.js';
|
|
5
|
-
import type { BuiltinTheme, CodeOptionsThemes, CodeToHastOptionsCommon } from 'shiki';
|
|
6
4
|
import type { NoReference } from './utils/schema.js';
|
|
7
5
|
import type { ProcessedDocument } from './utils/process-document.js';
|
|
8
6
|
import type { MediaAdapter } from './media/adapter.js';
|
|
7
|
+
import type { SharedOpenAPIOptions } from './server/index.js';
|
|
9
8
|
export type Document = V3_1.Document;
|
|
10
9
|
export type OperationObject = V3_1.OperationObject;
|
|
11
10
|
export type ParameterObject = V3_1.ParameterObject;
|
|
@@ -20,48 +19,18 @@ export type ServerVariableObject = NoReference<V3_1.ServerVariableObject>;
|
|
|
20
19
|
export type MethodInformation = NoReference<OperationObject> & {
|
|
21
20
|
method: string;
|
|
22
21
|
};
|
|
23
|
-
type Awaitable<T> = T | Promise<T>;
|
|
24
22
|
/**
|
|
25
23
|
* Dereferenced value and its original `$ref` value
|
|
26
24
|
*/
|
|
27
25
|
export type DereferenceMap = Map<unknown, string>;
|
|
28
|
-
export interface RenderContext {
|
|
29
|
-
/**
|
|
30
|
-
* The url of proxy to avoid CORS issues
|
|
31
|
-
*/
|
|
32
|
-
proxyUrl?: string;
|
|
26
|
+
export interface RenderContext extends SharedOpenAPIOptions {
|
|
33
27
|
renderer: Renderer;
|
|
34
|
-
/**
|
|
35
|
-
* Disable API Playground
|
|
36
|
-
*/
|
|
37
|
-
disablePlayground?: boolean;
|
|
38
28
|
servers: ServerObject[];
|
|
39
29
|
slugger: Slugger;
|
|
40
30
|
/**
|
|
41
31
|
* dereferenced schema
|
|
42
32
|
*/
|
|
43
33
|
schema: ProcessedDocument;
|
|
44
|
-
/**
|
|
45
|
-
* Generate TypeScript definitions from response schema.
|
|
46
|
-
*
|
|
47
|
-
* Pass `false` to disable it.
|
|
48
|
-
*
|
|
49
|
-
* @param method - the operation object
|
|
50
|
-
* @param statusCode - status code
|
|
51
|
-
*/
|
|
52
|
-
generateTypeScriptSchema?: ((method: NoReference<MethodInformation>, statusCode: string) => Awaitable<string>) | false;
|
|
53
|
-
/**
|
|
54
|
-
* Generate code samples for endpoint.
|
|
55
|
-
*/
|
|
56
|
-
generateCodeSamples?: (method: MethodInformation) => Awaitable<CodeSample[]>;
|
|
57
|
-
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
58
|
-
/**
|
|
59
|
-
* Show full response schema instead of only example response & Typescript definitions
|
|
60
|
-
*
|
|
61
|
-
* @default true
|
|
62
|
-
*/
|
|
63
|
-
showResponseSchema?: boolean;
|
|
64
34
|
mediaAdapters: Record<string, MediaAdapter>;
|
|
65
35
|
}
|
|
66
|
-
export {};
|
|
67
36
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"types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;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAElD,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAE1B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC7C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiPageProps } from '../render/api-page.js';
|
|
2
2
|
import type { GenerateOptions } from '../generate.js';
|
|
3
3
|
import type { TagObject } from '../types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ProcessedDocument } from '../utils/process-document.js';
|
|
5
5
|
export type DocumentContext = {
|
|
6
6
|
type: 'tag';
|
|
7
7
|
tag: TagObject | undefined;
|
|
@@ -10,7 +10,7 @@ export type DocumentContext = {
|
|
|
10
10
|
} | {
|
|
11
11
|
type: 'file';
|
|
12
12
|
};
|
|
13
|
-
export declare function generateDocument(
|
|
13
|
+
export declare function generateDocument(schemaId: string, processed: ProcessedDocument, pageProps: Omit<ApiPageProps, 'document'>, options: GenerateOptions & {
|
|
14
14
|
title: string;
|
|
15
15
|
description?: string;
|
|
16
16
|
}, context: DocumentContext): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-document.d.ts","sourceRoot":"","sources":["../../src/utils/generate-document.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"generate-document.d.ts","sourceRoot":"","sources":["../../src/utils/generate-document.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAOlE,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,SAAS,GAAG,SAAS,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,WAAW,CAAC;CACnB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,EACzC,OAAO,EAAE,eAAe,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,OAAO,EAAE,eAAe,GACvB,MAAM,CAkER"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { dump } from 'js-yaml';
|
|
2
2
|
import Slugger from 'github-slugger';
|
|
3
3
|
import { idToTitle } from '../utils/id-to-title.js';
|
|
4
|
-
export function generateDocument(
|
|
4
|
+
export function generateDocument(schemaId, processed, pageProps, options, context) {
|
|
5
5
|
const { frontmatter, includeDescription = false, addGeneratedComment = true, } = options;
|
|
6
6
|
const out = [];
|
|
7
7
|
const extend = frontmatter?.(options.title, options.description, context);
|
|
8
8
|
const page = {
|
|
9
9
|
...pageProps,
|
|
10
|
-
document:
|
|
10
|
+
document: schemaId,
|
|
11
11
|
};
|
|
12
12
|
let meta;
|
|
13
13
|
if (page.operations?.length === 1) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DereferenceMap, Document } from '../types.js';
|
|
2
2
|
import type { NoReference } from '../utils/schema.js';
|
|
3
3
|
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
4
|
-
export type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
|
|
5
4
|
export type ProcessedDocument = {
|
|
6
5
|
document: NoReference<Document>;
|
|
7
6
|
dereferenceMap: DereferenceMap;
|
|
@@ -10,5 +9,5 @@ export type ProcessedDocument = {
|
|
|
10
9
|
/**
|
|
11
10
|
* process & reference input document to a Fumadocs OpenAPI compatible format
|
|
12
11
|
*/
|
|
13
|
-
export declare function processDocument(input:
|
|
12
|
+
export declare function processDocument(input: string | OpenAPIV3_1.Document | OpenAPIV3.Document, disableCache?: boolean): Promise<ProcessedDocument>;
|
|
14
13
|
//# sourceMappingURL=process-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC;CACtB,CAAC;AAIF;;GAEG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,EACzD,YAAY,UAAQ,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA+B5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fumari/json-schema-to-typescript": "^1.1.3",
|
|
49
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
50
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
51
|
-
"@radix-ui/react-select": "^2.2.
|
|
49
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
50
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
51
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
52
52
|
"@radix-ui/react-slot": "^1.2.3",
|
|
53
53
|
"@scalar/openapi-parser": "0.18.3",
|
|
54
54
|
"ajv": "^8.17.1",
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"shiki": "^3.9.2",
|
|
65
65
|
"tinyglobby": "^0.2.14",
|
|
66
66
|
"xml-js": "^1.6.11",
|
|
67
|
-
"fumadocs-
|
|
68
|
-
"fumadocs-
|
|
67
|
+
"fumadocs-core": "15.6.12",
|
|
68
|
+
"fumadocs-ui": "15.6.12"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@scalar/api-client-react": "^1.3.27",
|
|
72
72
|
"@types/js-yaml": "^4.0.9",
|
|
73
|
-
"@types/node": "24.
|
|
73
|
+
"@types/node": "24.3.0",
|
|
74
74
|
"@types/openapi-sampler": "^1.0.3",
|
|
75
75
|
"@types/react": "^19.1.10",
|
|
76
76
|
"json-schema-typed": "^8.0.1",
|
|
77
77
|
"openapi-types": "^12.1.3",
|
|
78
|
-
"tailwindcss": "^4.1.
|
|
78
|
+
"tailwindcss": "^4.1.12",
|
|
79
79
|
"tsc-alias": "^1.8.16",
|
|
80
80
|
"eslint-config-custom": "0.0.0",
|
|
81
81
|
"tsconfig": "0.0.0"
|