docusaurus-plugin-openapi-docs 0.0.0-573 → 0.0.0-575
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/lib/index.js +3 -0
- package/lib/openapi/openapi.js +6 -0
- package/lib/openapi/utils/loadAndResolveSpec.js +13 -0
- package/lib/options.js +1 -0
- package/lib/types.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/openapi/openapi.ts +6 -0
- package/src/openapi/utils/loadAndResolveSpec.ts +15 -0
- package/src/options.ts +1 -0
- package/src/types.ts +1 -0
package/lib/index.js
CHANGED
package/lib/openapi/openapi.js
CHANGED
|
@@ -173,6 +173,9 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
173
173
|
.replace(/\s+$/, "")
|
|
174
174
|
: "",
|
|
175
175
|
...((options === null || options === void 0 ? void 0 : options.proxy) && { proxy: options.proxy }),
|
|
176
|
+
...((options === null || options === void 0 ? void 0 : options.hideSendButton) && {
|
|
177
|
+
hide_send_button: options.hideSendButton,
|
|
178
|
+
}),
|
|
176
179
|
},
|
|
177
180
|
api: {
|
|
178
181
|
...defaults,
|
|
@@ -264,6 +267,9 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
264
267
|
.replace(/\s+$/, "")
|
|
265
268
|
: "",
|
|
266
269
|
...((options === null || options === void 0 ? void 0 : options.proxy) && { proxy: options.proxy }),
|
|
270
|
+
...((options === null || options === void 0 ? void 0 : options.hideSendButton) && {
|
|
271
|
+
hide_send_button: options.hideSendButton,
|
|
272
|
+
}),
|
|
267
273
|
},
|
|
268
274
|
api: {
|
|
269
275
|
...defaults,
|
|
@@ -114,6 +114,19 @@ async function loadAndResolveSpec(specUrlOrObject) {
|
|
|
114
114
|
// Force dereference ?
|
|
115
115
|
// bundleOpts["dereference"] = true;
|
|
116
116
|
const { bundle: { parsed }, } = await (0, openapi_core_1.bundle)(bundleOpts);
|
|
117
|
+
//Pre-processing before resolving JSON refs
|
|
118
|
+
if (parsed.components) {
|
|
119
|
+
for (let [component, type] of Object.entries(parsed.components)) {
|
|
120
|
+
if (component === "schemas") {
|
|
121
|
+
for (let [schemaKey, schemaValue] of Object.entries(type)) {
|
|
122
|
+
const title = schemaValue["title"];
|
|
123
|
+
if (!title) {
|
|
124
|
+
schemaValue.title = schemaKey;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
117
130
|
const resolved = await resolveJsonRefs(parsed);
|
|
118
131
|
// Force serialization and replace circular $ref pointers
|
|
119
132
|
// @ts-ignore
|
package/lib/options.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
25
25
|
outputDir: utils_validation_1.Joi.string().required(),
|
|
26
26
|
template: utils_validation_1.Joi.string(),
|
|
27
27
|
downloadUrl: utils_validation_1.Joi.string(),
|
|
28
|
+
hideSendButton: utils_validation_1.Joi.boolean(),
|
|
28
29
|
sidebarOptions: sidebarOptions,
|
|
29
30
|
version: utils_validation_1.Joi.string().when("versions", {
|
|
30
31
|
is: utils_validation_1.Joi.exist(),
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-575",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=14"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9f2479bd7257534ab220aef80aa6783ef223b2ac"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
package/src/openapi/openapi.ts
CHANGED
|
@@ -221,6 +221,9 @@ function createItems(
|
|
|
221
221
|
.replace(/\s+$/, "")
|
|
222
222
|
: "",
|
|
223
223
|
...(options?.proxy && { proxy: options.proxy }),
|
|
224
|
+
...(options?.hideSendButton && {
|
|
225
|
+
hide_send_button: options.hideSendButton,
|
|
226
|
+
}),
|
|
224
227
|
},
|
|
225
228
|
api: {
|
|
226
229
|
...defaults,
|
|
@@ -338,6 +341,9 @@ function createItems(
|
|
|
338
341
|
.replace(/\s+$/, "")
|
|
339
342
|
: "",
|
|
340
343
|
...(options?.proxy && { proxy: options.proxy }),
|
|
344
|
+
...(options?.hideSendButton && {
|
|
345
|
+
hide_send_button: options.hideSendButton,
|
|
346
|
+
}),
|
|
341
347
|
},
|
|
342
348
|
api: {
|
|
343
349
|
...defaults,
|
|
@@ -128,6 +128,21 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
|
|
|
128
128
|
const {
|
|
129
129
|
bundle: { parsed },
|
|
130
130
|
} = await bundle(bundleOpts);
|
|
131
|
+
|
|
132
|
+
//Pre-processing before resolving JSON refs
|
|
133
|
+
if (parsed.components) {
|
|
134
|
+
for (let [component, type] of Object.entries(parsed.components) as any) {
|
|
135
|
+
if (component === "schemas") {
|
|
136
|
+
for (let [schemaKey, schemaValue] of Object.entries(type) as any) {
|
|
137
|
+
const title: string | undefined = schemaValue["title"];
|
|
138
|
+
if (!title) {
|
|
139
|
+
schemaValue.title = schemaKey;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
131
146
|
const resolved = await resolveJsonRefs(parsed);
|
|
132
147
|
|
|
133
148
|
// Force serialization and replace circular $ref pointers
|
package/src/options.ts
CHANGED
|
@@ -27,6 +27,7 @@ export const OptionsSchema = Joi.object({
|
|
|
27
27
|
outputDir: Joi.string().required(),
|
|
28
28
|
template: Joi.string(),
|
|
29
29
|
downloadUrl: Joi.string(),
|
|
30
|
+
hideSendButton: Joi.boolean(),
|
|
30
31
|
sidebarOptions: sidebarOptions,
|
|
31
32
|
version: Joi.string().when("versions", {
|
|
32
33
|
is: Joi.exist(),
|