docusaurus-plugin-openapi-docs 0.0.0-996 → 0.0.0-998

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
@@ -78,7 +78,7 @@ function pluginOpenAPIDocs(context, options) {
78
78
  let docPath = docData ? (docData.path ? docData.path : "docs") : undefined;
79
79
  async function generateApiDocs(options, pluginId) {
80
80
  var _a, _b, _c, _d;
81
- let { specPath, outputDir, template, markdownGenerators, downloadUrl, sidebarOptions, disableCompression, } = options;
81
+ let { specPath, outputDir, template, infoTemplate, tagTemplate, schemaTemplate, markdownGenerators, downloadUrl, sidebarOptions, disableCompression, } = options;
82
82
  // Remove trailing slash before proceeding
83
83
  outputDir = outputDir.replace(/\/$/, "");
84
84
  // Override docPath if pluginId provided
@@ -163,7 +163,9 @@ show_extensions: true
163
163
 
164
164
  {{{markdown}}}
165
165
  `;
166
- const infoMdTemplate = `---
166
+ const infoMdTemplate = infoTemplate
167
+ ? fs_1.default.readFileSync(infoTemplate).toString()
168
+ : `---
167
169
  id: {{{id}}}
168
170
  title: "{{{title}}}"
169
171
  description: "{{{frontMatter.description}}}"
@@ -181,7 +183,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
181
183
  <DocCardList items={useCurrentSidebarCategory().items}/>
182
184
  \`\`\`
183
185
  `;
184
- const tagMdTemplate = `---
186
+ const tagMdTemplate = tagTemplate
187
+ ? fs_1.default.readFileSync(tagTemplate).toString()
188
+ : `---
185
189
  id: {{{id}}}
186
190
  title: "{{{frontMatter.description}}}"
187
191
  description: "{{{frontMatter.description}}}"
@@ -197,7 +201,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
197
201
  <DocCardList items={useCurrentSidebarCategory().items}/>
198
202
  \`\`\`
199
203
  `;
200
- const schemaMdTemplate = `---
204
+ const schemaMdTemplate = schemaTemplate
205
+ ? fs_1.default.readFileSync(schemaTemplate).toString()
206
+ : `---
201
207
  id: {{{id}}}
202
208
  title: "{{{title}}}"
203
209
  description: "{{{frontMatter.description}}}"
@@ -270,13 +276,10 @@ custom_edit_url: null
270
276
  }
271
277
  }
272
278
  }
273
- // TODO: determine if we actually want/need this
274
279
  if (item.type === "info") {
275
280
  if (!fs_1.default.existsSync(`${outputDir}/${item.id}.info.mdx`)) {
276
281
  try {
277
- (sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.categoryLinkSource) === "info" // Only use utils template if set to "info"
278
- ? fs_1.default.writeFileSync(`${outputDir}/${item.id}.info.mdx`, utils, "utf8")
279
- : fs_1.default.writeFileSync(`${outputDir}/${item.id}.info.mdx`, view, "utf8");
282
+ fs_1.default.writeFileSync(`${outputDir}/${item.id}.info.mdx`, utils, "utf8");
280
283
  console.log(chalk_1.default.green(`Successfully created "${outputDir}/${item.id}.info.mdx"`));
281
284
  }
282
285
  catch (err) {
package/lib/options.js CHANGED
@@ -35,6 +35,9 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
35
35
  proxy: utils_validation_1.Joi.string(),
36
36
  outputDir: utils_validation_1.Joi.string().required(),
37
37
  template: utils_validation_1.Joi.string(),
38
+ infoTemplate: utils_validation_1.Joi.string(),
39
+ tagTemplate: utils_validation_1.Joi.string(),
40
+ schemaTemplate: utils_validation_1.Joi.string(),
38
41
  downloadUrl: utils_validation_1.Joi.string(),
39
42
  hideSendButton: utils_validation_1.Joi.boolean(),
40
43
  showExtensions: utils_validation_1.Joi.boolean(),
package/lib/types.d.ts CHANGED
@@ -14,6 +14,9 @@ export interface APIOptions {
14
14
  specPath: string;
15
15
  outputDir: string;
16
16
  template?: string;
17
+ infoTemplate?: string;
18
+ tagTemplate?: string;
19
+ schemaTemplate?: string;
17
20
  downloadUrl?: string;
18
21
  hideSendButton?: boolean;
19
22
  showExtensions?: boolean;
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-996",
4
+ "version": "0.0.0-998",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -65,5 +65,5 @@
65
65
  "engines": {
66
66
  "node": ">=14"
67
67
  },
68
- "gitHead": "b6caef9cf6765bef67b15261222df6730f578a3d"
68
+ "gitHead": "5cb443ea0c67f1c41d7280f55fa8f85cae48c6e1"
69
69
  }
package/src/index.ts CHANGED
@@ -117,6 +117,9 @@ export default function pluginOpenAPIDocs(
117
117
  specPath,
118
118
  outputDir,
119
119
  template,
120
+ infoTemplate,
121
+ tagTemplate,
122
+ schemaTemplate,
120
123
  markdownGenerators,
121
124
  downloadUrl,
122
125
  sidebarOptions,
@@ -236,7 +239,9 @@ show_extensions: true
236
239
  {{{markdown}}}
237
240
  `;
238
241
 
239
- const infoMdTemplate = `---
242
+ const infoMdTemplate = infoTemplate
243
+ ? fs.readFileSync(infoTemplate).toString()
244
+ : `---
240
245
  id: {{{id}}}
241
246
  title: "{{{title}}}"
242
247
  description: "{{{frontMatter.description}}}"
@@ -255,7 +260,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
255
260
  \`\`\`
256
261
  `;
257
262
 
258
- const tagMdTemplate = `---
263
+ const tagMdTemplate = tagTemplate
264
+ ? fs.readFileSync(tagTemplate).toString()
265
+ : `---
259
266
  id: {{{id}}}
260
267
  title: "{{{frontMatter.description}}}"
261
268
  description: "{{{frontMatter.description}}}"
@@ -272,7 +279,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
272
279
  \`\`\`
273
280
  `;
274
281
 
275
- const schemaMdTemplate = `---
282
+ const schemaMdTemplate = schemaTemplate
283
+ ? fs.readFileSync(schemaTemplate).toString()
284
+ : `---
276
285
  id: {{{id}}}
277
286
  title: "{{{title}}}"
278
287
  description: "{{{frontMatter.description}}}"
@@ -371,21 +380,14 @@ custom_edit_url: null
371
380
  }
372
381
  }
373
382
 
374
- // TODO: determine if we actually want/need this
375
383
  if (item.type === "info") {
376
384
  if (!fs.existsSync(`${outputDir}/${item.id}.info.mdx`)) {
377
385
  try {
378
- sidebarOptions?.categoryLinkSource === "info" // Only use utils template if set to "info"
379
- ? fs.writeFileSync(
380
- `${outputDir}/${item.id}.info.mdx`,
381
- utils,
382
- "utf8"
383
- )
384
- : fs.writeFileSync(
385
- `${outputDir}/${item.id}.info.mdx`,
386
- view,
387
- "utf8"
388
- );
386
+ fs.writeFileSync(
387
+ `${outputDir}/${item.id}.info.mdx`,
388
+ utils,
389
+ "utf8"
390
+ );
389
391
  console.log(
390
392
  chalk.green(
391
393
  `Successfully created "${outputDir}/${item.id}.info.mdx"`
package/src/options.ts CHANGED
@@ -39,6 +39,9 @@ export const OptionsSchema = Joi.object({
39
39
  proxy: Joi.string(),
40
40
  outputDir: Joi.string().required(),
41
41
  template: Joi.string(),
42
+ infoTemplate: Joi.string(),
43
+ tagTemplate: Joi.string(),
44
+ schemaTemplate: Joi.string(),
42
45
  downloadUrl: Joi.string(),
43
46
  hideSendButton: Joi.boolean(),
44
47
  showExtensions: Joi.boolean(),
package/src/types.ts CHANGED
@@ -35,6 +35,9 @@ export interface APIOptions {
35
35
  specPath: string;
36
36
  outputDir: string;
37
37
  template?: string;
38
+ infoTemplate?: string;
39
+ tagTemplate?: string;
40
+ schemaTemplate?: string;
38
41
  downloadUrl?: string;
39
42
  hideSendButton?: boolean;
40
43
  showExtensions?: boolean;