fumadocs-openapi 5.7.5 → 5.8.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 +59 -27
- package/dist/index.js +182 -141
- package/dist/server/index.d.ts +39 -12
- package/dist/server/index.js +321 -172
- package/dist/ui/{client-client-Ddkf37Pm.js → client-client-D9KEBAUd.js} +7 -7
- package/dist/ui/index.d.ts +27 -10
- package/dist/ui/index.js +6 -5
- package/dist/ui/{playground-client-DPxpLHKJ.js → playground-client-C0GkAwm2.js} +2 -2
- package/package.json +10 -9
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
2
1
|
import { ComponentType, ReactNode, FC } from 'react';
|
|
2
|
+
import { OpenAPIV3_1, OpenAPIV3 } from 'openapi-types';
|
|
3
3
|
import Slugger from 'github-slugger';
|
|
4
4
|
import { CodeToHastOptionsCommon, CodeOptionsThemes, BuiltinTheme } from 'shiki';
|
|
5
5
|
import { BuildPageTreeOptions } from 'fumadocs-core/source';
|
|
@@ -73,6 +73,7 @@ interface APIInfoProps {
|
|
|
73
73
|
method: string;
|
|
74
74
|
route: string;
|
|
75
75
|
baseUrls: string[];
|
|
76
|
+
head: ReactNode;
|
|
76
77
|
children: ReactNode;
|
|
77
78
|
}
|
|
78
79
|
interface PropertyProps {
|
|
@@ -128,6 +129,11 @@ interface Renderer {
|
|
|
128
129
|
APIPlayground: ComponentType<APIPlaygroundProps>;
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
type NoReference<T> = T extends (infer I)[] ? NoReference<I>[] : T extends ReferenceObject ? Exclude<T, ReferenceObject> : T extends object ? {
|
|
133
|
+
[K in keyof T]: NoReference<T[K]>;
|
|
134
|
+
} : T;
|
|
135
|
+
type ParsedSchema = OpenAPIV3_1.SchemaObject;
|
|
136
|
+
|
|
131
137
|
/**
|
|
132
138
|
* Sample info of endpoint
|
|
133
139
|
*/
|
|
@@ -138,7 +144,7 @@ interface EndpointSample {
|
|
|
138
144
|
url: string;
|
|
139
145
|
method: string;
|
|
140
146
|
body?: {
|
|
141
|
-
schema:
|
|
147
|
+
schema: ParsedSchema;
|
|
142
148
|
mediaType: string;
|
|
143
149
|
sample: unknown;
|
|
144
150
|
};
|
|
@@ -148,12 +154,12 @@ interface EndpointSample {
|
|
|
148
154
|
interface ResponseSample {
|
|
149
155
|
mediaType: string;
|
|
150
156
|
sample: unknown;
|
|
151
|
-
schema:
|
|
157
|
+
schema: ParsedSchema;
|
|
152
158
|
}
|
|
153
159
|
interface ParameterSample {
|
|
154
160
|
name: string;
|
|
155
161
|
in: string;
|
|
156
|
-
schema:
|
|
162
|
+
schema: ParsedSchema;
|
|
157
163
|
sample: unknown;
|
|
158
164
|
}
|
|
159
165
|
|
|
@@ -163,12 +169,23 @@ interface CodeSample {
|
|
|
163
169
|
source: string | ((endpoint: EndpointSample) => string | undefined) | false;
|
|
164
170
|
}
|
|
165
171
|
|
|
172
|
+
type Document = OpenAPIV3_1.Document;
|
|
173
|
+
type ReferenceObject = OpenAPIV3_1.ReferenceObject;
|
|
166
174
|
type Awaitable<T> = T | Promise<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Dereferenced value and its original `$ref` value
|
|
177
|
+
*/
|
|
178
|
+
type DereferenceMap = Map<unknown, string>;
|
|
167
179
|
interface RenderContext {
|
|
168
180
|
renderer: Renderer;
|
|
169
|
-
|
|
181
|
+
/**
|
|
182
|
+
* dereferenced schema
|
|
183
|
+
*/
|
|
184
|
+
document: NoReference<Document>;
|
|
170
185
|
baseUrl: string;
|
|
186
|
+
baseUrls: string[];
|
|
171
187
|
slugger: Slugger;
|
|
188
|
+
dereferenceMap: DereferenceMap;
|
|
172
189
|
/**
|
|
173
190
|
* Generate TypeScript definitions from response schema.
|
|
174
191
|
*
|
|
@@ -185,26 +202,36 @@ interface RenderContext {
|
|
|
185
202
|
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
186
203
|
}
|
|
187
204
|
|
|
205
|
+
type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
|
|
206
|
+
|
|
188
207
|
interface ApiPageProps extends Pick<RenderContext, 'generateCodeSamples' | 'generateTypeScriptSchema' | 'shikiOptions'> {
|
|
189
|
-
document:
|
|
208
|
+
document: DocumentInput;
|
|
209
|
+
hasHead: boolean;
|
|
210
|
+
renderer?: Partial<Renderer>;
|
|
190
211
|
/**
|
|
191
212
|
* An array of operations
|
|
192
213
|
*/
|
|
193
|
-
operations
|
|
194
|
-
|
|
195
|
-
|
|
214
|
+
operations?: OperationItem[];
|
|
215
|
+
webhooks?: WebhookItem[];
|
|
216
|
+
/**
|
|
217
|
+
* By default, it is disabled on dev mode
|
|
218
|
+
*/
|
|
196
219
|
disableCache?: boolean;
|
|
197
220
|
}
|
|
198
|
-
interface
|
|
221
|
+
interface WebhookItem {
|
|
222
|
+
name: string;
|
|
223
|
+
method: OpenAPIV3_1.HttpMethods;
|
|
224
|
+
}
|
|
225
|
+
interface OperationItem {
|
|
199
226
|
path: string;
|
|
200
|
-
method:
|
|
227
|
+
method: OpenAPIV3_1.HttpMethods;
|
|
201
228
|
}
|
|
202
229
|
|
|
203
230
|
interface OpenAPIOptions extends Omit<Partial<ApiPageProps>, 'document'> {
|
|
204
231
|
/**
|
|
205
232
|
* @deprecated Pass document to `APIPage` instead
|
|
206
233
|
*/
|
|
207
|
-
documentOrPath?:
|
|
234
|
+
documentOrPath?: DocumentInput;
|
|
208
235
|
}
|
|
209
236
|
interface OpenAPIServer {
|
|
210
237
|
APIPage: FC<ApiPageProps>;
|