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 CHANGED
@@ -149,6 +149,9 @@ custom_edit_url: null
149
149
  {{#frontMatter.proxy}}
150
150
  proxy: {{{frontMatter.proxy}}}
151
151
  {{/frontMatter.proxy}}
152
+ {{#frontMatter.hide_send_button}}
153
+ hide_send_button: true
154
+ {{/frontMatter.hide_send_button}}
152
155
  ---
153
156
 
154
157
  {{{markdown}}}
@@ -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
@@ -13,6 +13,7 @@ export interface APIOptions {
13
13
  outputDir: string;
14
14
  template?: string;
15
15
  downloadUrl?: string;
16
+ hideSendButton?: boolean;
16
17
  sidebarOptions?: SidebarOptions;
17
18
  version?: string;
18
19
  label?: string;
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-573",
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": "a584334c8e04f672fd778d6e80836f6d5b18611a"
71
+ "gitHead": "9f2479bd7257534ab220aef80aa6783ef223b2ac"
72
72
  }
package/src/index.ts CHANGED
@@ -190,6 +190,9 @@ custom_edit_url: null
190
190
  {{#frontMatter.proxy}}
191
191
  proxy: {{{frontMatter.proxy}}}
192
192
  {{/frontMatter.proxy}}
193
+ {{#frontMatter.hide_send_button}}
194
+ hide_send_button: true
195
+ {{/frontMatter.hide_send_button}}
193
196
  ---
194
197
 
195
198
  {{{markdown}}}
@@ -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(),
package/src/types.ts CHANGED
@@ -33,6 +33,7 @@ export interface APIOptions {
33
33
  outputDir: string;
34
34
  template?: string;
35
35
  downloadUrl?: string;
36
+ hideSendButton?: boolean;
36
37
  sidebarOptions?: SidebarOptions;
37
38
  version?: string;
38
39
  label?: string;