fumadocs-openapi 5.1.0 → 5.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/index.d.ts +2 -2
- package/dist/index.js +4 -22
- package/dist/server/index.js +0 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -247,10 +247,10 @@ interface Config extends GenerateOptions {
|
|
|
247
247
|
output: string;
|
|
248
248
|
/**
|
|
249
249
|
* tag: Generate a page for each tag
|
|
250
|
-
*
|
|
251
250
|
* file: Generate a page for each schema
|
|
251
|
+
* operation: Generate a page for each API endpoint/operation
|
|
252
252
|
*
|
|
253
|
-
* @defaultValue
|
|
253
|
+
* @defaultValue 'operation'
|
|
254
254
|
*/
|
|
255
255
|
per?: 'tag' | 'file' | 'operation';
|
|
256
256
|
/**
|
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ function generateDocument(options) {
|
|
|
95
95
|
if (imports) {
|
|
96
96
|
out.push(imports);
|
|
97
97
|
}
|
|
98
|
-
out.push(pageContent(
|
|
98
|
+
out.push(pageContent(options.page));
|
|
99
99
|
return out.join('\n\n');
|
|
100
100
|
}
|
|
101
101
|
function generateStaticData(dereferenced, props) {
|
|
@@ -131,26 +131,8 @@ function generateStaticData(dereferenced, props) {
|
|
|
131
131
|
structuredData
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
function pageContent(
|
|
135
|
-
|
|
136
|
-
// it may not be compatible with other content sources except Fumadocs MDX
|
|
137
|
-
// TODO: Maybe add to frontmatter and let developers to handle them?
|
|
138
|
-
return `<APIPage document={${JSON.stringify(props.document)}} operations={${JSON.stringify(props.operations)}} hasHead={${JSON.stringify(props.hasHead)}} />
|
|
139
|
-
|
|
140
|
-
export function startup() {
|
|
141
|
-
if (typeof toc !== 'undefined') {
|
|
142
|
-
// toc might be immutable
|
|
143
|
-
while (toc.length > 0) toc.pop()
|
|
144
|
-
toc.push(...${JSON.stringify(data.toc)})
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (typeof structuredData !== 'undefined') {
|
|
148
|
-
structuredData.headings = ${JSON.stringify(data.structuredData.headings)}
|
|
149
|
-
structuredData.contents = ${JSON.stringify(data.structuredData.contents)}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
{startup()}`;
|
|
134
|
+
function pageContent(props) {
|
|
135
|
+
return `<APIPage document={${JSON.stringify(props.document)}} operations={${JSON.stringify(props.operations)}} hasHead={${JSON.stringify(props.hasHead)}} />`;
|
|
154
136
|
}
|
|
155
137
|
|
|
156
138
|
async function dereference(pathOrDocument, options) {
|
|
@@ -257,7 +239,7 @@ async function generateTags(pathOrDocument, options = {}) {
|
|
|
257
239
|
}
|
|
258
240
|
|
|
259
241
|
async function generateFiles(options) {
|
|
260
|
-
const { input, output, name: nameFn, per = '
|
|
242
|
+
const { input, output, name: nameFn, per = 'operation', groupBy = 'none', cwd = process.cwd() } = options;
|
|
261
243
|
const outputDir = join(cwd, output);
|
|
262
244
|
const urlInputs = [];
|
|
263
245
|
const fileInputs = [];
|
package/dist/server/index.js
CHANGED
|
@@ -1090,8 +1090,6 @@ function getBadgeColor(method) {
|
|
|
1090
1090
|
if ('_openapi' in data && typeof data._openapi === 'object') {
|
|
1091
1091
|
const meta = data._openapi;
|
|
1092
1092
|
method = meta.method;
|
|
1093
|
-
} else if ('method' in data && typeof data.method === 'string') {
|
|
1094
|
-
method = data.method;
|
|
1095
1093
|
}
|
|
1096
1094
|
if (method) {
|
|
1097
1095
|
const color = getBadgeColor(method);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"remark": "^15.0.0",
|
|
61
61
|
"shiki": "^1.12.1",
|
|
62
62
|
"swr": "^2.2.5",
|
|
63
|
-
"fumadocs-core": "13.2.
|
|
64
|
-
"fumadocs-ui": "13.2.
|
|
63
|
+
"fumadocs-core": "13.2.2",
|
|
64
|
+
"fumadocs-ui": "13.2.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/js-yaml": "^4.0.9",
|