docusaurus-plugin-openapi-docs 0.0.0-1050 → 0.0.0-1055
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/README.md +21 -19
- package/lib/index.js +3 -0
- package/lib/openapi/openapi.js +6 -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 +7 -1
- package/src/options.ts +1 -0
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -127,6 +127,7 @@ import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
|
|
|
127
127
|
petstore: {
|
|
128
128
|
specPath: "examples/petstore.yaml",
|
|
129
129
|
outputDir: "docs/petstore",
|
|
130
|
+
maskCredentials: false, // Disable credential masking in code snippets
|
|
130
131
|
sidebarOptions: {
|
|
131
132
|
groupPathsBy: "tag",
|
|
132
133
|
},
|
|
@@ -155,25 +156,26 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
|
|
|
155
156
|
|
|
156
157
|
`config` can be configured with the following options:
|
|
157
158
|
|
|
158
|
-
| Name | Type | Default | Description
|
|
159
|
-
| -------------------- | --------- | ------- |
|
|
160
|
-
| `specPath` | `string` | `null` | Designated URL or path to the source of an OpenAPI specification file or directory of multiple OpenAPI specification files.
|
|
161
|
-
| `outputDir` | `string` | `null` | Desired output path for generated MDX and sidebar files.
|
|
162
|
-
| `proxy` | `string` | `null` | _Optional:_ Proxy URL to prepend to base URL when performing API requests from browser.
|
|
163
|
-
| `template` | `string` | `null` | _Optional:_ Customize MDX content with a desired template.
|
|
164
|
-
| `infoTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **info** pages only.
|
|
165
|
-
| `tagTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **tag** pages only.
|
|
166
|
-
| `schemaTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **schema** pages only.
|
|
167
|
-
| `downloadUrl` | `string` | `null` | _Optional:_ Designated URL for downloading OpenAPI specification. (requires `info` section/doc)
|
|
168
|
-
| `hideSendButton` | `boolean` | `null` | _Optional:_ If set to `true`, hides the “Send API Request” button in the API demo panel.
|
|
169
|
-
| `showExtensions` | `boolean` | `null` | _Optional:_ If set to `true`, renders operation‑level vendor‑extensions in descriptions.
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
159
|
+
| Name | Type | Default | Description |
|
|
160
|
+
| -------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
161
|
+
| `specPath` | `string` | `null` | Designated URL or path to the source of an OpenAPI specification file or directory of multiple OpenAPI specification files. |
|
|
162
|
+
| `outputDir` | `string` | `null` | Desired output path for generated MDX and sidebar files. |
|
|
163
|
+
| `proxy` | `string` | `null` | _Optional:_ Proxy URL to prepend to base URL when performing API requests from browser. |
|
|
164
|
+
| `template` | `string` | `null` | _Optional:_ Customize MDX content with a desired template. |
|
|
165
|
+
| `infoTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **info** pages only. |
|
|
166
|
+
| `tagTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **tag** pages only. |
|
|
167
|
+
| `schemaTemplate` | `string` | `null` | _Optional:_ Customize MDX content for **schema** pages only. |
|
|
168
|
+
| `downloadUrl` | `string` | `null` | _Optional:_ Designated URL for downloading OpenAPI specification. (requires `info` section/doc) |
|
|
169
|
+
| `hideSendButton` | `boolean` | `null` | _Optional:_ If set to `true`, hides the “Send API Request” button in the API demo panel. |
|
|
170
|
+
| `showExtensions` | `boolean` | `null` | _Optional:_ If set to `true`, renders operation‑level vendor‑extensions in descriptions. |
|
|
171
|
+
| `maskCredentials` | `boolean` | `true` | _Optional:_ If set to `false`, disables credential masking in generated code snippets. By default, credentials are masked for security. |
|
|
172
|
+
| `sidebarOptions` | `object` | `null` | _Optional:_ Set of options for sidebar configuration. See below for a list of supported options. |
|
|
173
|
+
| `version` | `string` | `null` | _Optional:_ Version assigned to a single or micro‑spec API specified in `specPath`. |
|
|
174
|
+
| `label` | `string` | `null` | _Optional:_ Version label used when generating the version‑selector dropdown menu. |
|
|
175
|
+
| `baseUrl` | `string` | `null` | _Optional:_ Base URL for versioned docs in the version‑selector dropdown. |
|
|
176
|
+
| `versions` | `object` | `null` | _Optional:_ Options for versioning configuration. See below for a list of supported options. |
|
|
177
|
+
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content via generator functions. See below for a list of supported options. |
|
|
178
|
+
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates standalone schema pages and adds them to the sidebar. |
|
|
177
179
|
|
|
178
180
|
### sidebarOptions
|
|
179
181
|
|
package/lib/index.js
CHANGED
|
@@ -159,6 +159,9 @@ hide_send_button: true
|
|
|
159
159
|
{{#frontMatter.show_extensions}}
|
|
160
160
|
show_extensions: true
|
|
161
161
|
{{/frontMatter.show_extensions}}
|
|
162
|
+
{{#frontMatter.mask_credentials_disabled}}
|
|
163
|
+
mask_credentials: false
|
|
164
|
+
{{/frontMatter.mask_credentials_disabled}}
|
|
162
165
|
---
|
|
163
166
|
|
|
164
167
|
{{{markdown}}}
|
package/lib/openapi/openapi.js
CHANGED
|
@@ -236,6 +236,9 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
236
236
|
...((options === null || options === void 0 ? void 0 : options.showExtensions) && {
|
|
237
237
|
show_extensions: options.showExtensions,
|
|
238
238
|
}),
|
|
239
|
+
...((options === null || options === void 0 ? void 0 : options.maskCredentials) === false && {
|
|
240
|
+
mask_credentials_disabled: true,
|
|
241
|
+
}),
|
|
239
242
|
},
|
|
240
243
|
api: {
|
|
241
244
|
...defaults,
|
|
@@ -355,6 +358,9 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
355
358
|
...((options === null || options === void 0 ? void 0 : options.showExtensions) && {
|
|
356
359
|
show_extensions: options.showExtensions,
|
|
357
360
|
}),
|
|
361
|
+
...((options === null || options === void 0 ? void 0 : options.maskCredentials) === false && {
|
|
362
|
+
mask_credentials_disabled: true,
|
|
363
|
+
}),
|
|
358
364
|
},
|
|
359
365
|
api: {
|
|
360
366
|
...defaults,
|
package/lib/options.js
CHANGED
|
@@ -45,6 +45,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
45
45
|
markdownGenerators: markdownGenerators,
|
|
46
46
|
showSchemas: utils_validation_1.Joi.boolean(),
|
|
47
47
|
disableCompression: utils_validation_1.Joi.boolean(),
|
|
48
|
+
maskCredentials: utils_validation_1.Joi.boolean(),
|
|
48
49
|
version: utils_validation_1.Joi.string().when("versions", {
|
|
49
50
|
is: utils_validation_1.Joi.exist(),
|
|
50
51
|
then: utils_validation_1.Joi.required(),
|
package/lib/types.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface APIOptions {
|
|
|
30
30
|
markdownGenerators?: MarkdownGenerator;
|
|
31
31
|
showSchemas?: boolean;
|
|
32
32
|
disableCompression?: boolean;
|
|
33
|
+
maskCredentials?: boolean;
|
|
33
34
|
}
|
|
34
35
|
export interface MarkdownGenerator {
|
|
35
36
|
createApiPageMD?: (pageData: ApiPageMetadata) => 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-
|
|
4
|
+
"version": "0.0.0-1055",
|
|
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": "
|
|
68
|
+
"gitHead": "032eb64b64b19ba5d04fad6c1dcfaa2a96952f71"
|
|
69
69
|
}
|
package/src/index.ts
CHANGED
|
@@ -234,6 +234,9 @@ hide_send_button: true
|
|
|
234
234
|
{{#frontMatter.show_extensions}}
|
|
235
235
|
show_extensions: true
|
|
236
236
|
{{/frontMatter.show_extensions}}
|
|
237
|
+
{{#frontMatter.mask_credentials_disabled}}
|
|
238
|
+
mask_credentials: false
|
|
239
|
+
{{/frontMatter.mask_credentials_disabled}}
|
|
237
240
|
---
|
|
238
241
|
|
|
239
242
|
{{{markdown}}}
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -48,7 +48,7 @@ function jsonToCollection(data: OpenApiObject): Promise<Collection> {
|
|
|
48
48
|
if (!schemaPack.validationResult?.result) {
|
|
49
49
|
return reject(schemaPack.validationResult?.reason);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
schemaPack.convert((_err: any, conversionResult: any) => {
|
|
53
53
|
if (_err || !conversionResult.result) {
|
|
54
54
|
return reject(_err || conversionResult.reason);
|
|
@@ -256,6 +256,9 @@ function createItems(
|
|
|
256
256
|
...(options?.showExtensions && {
|
|
257
257
|
show_extensions: options.showExtensions,
|
|
258
258
|
}),
|
|
259
|
+
...(options?.maskCredentials === false && {
|
|
260
|
+
mask_credentials_disabled: true,
|
|
261
|
+
}),
|
|
259
262
|
},
|
|
260
263
|
api: {
|
|
261
264
|
...defaults,
|
|
@@ -409,6 +412,9 @@ function createItems(
|
|
|
409
412
|
...(options?.showExtensions && {
|
|
410
413
|
show_extensions: options.showExtensions,
|
|
411
414
|
}),
|
|
415
|
+
...(options?.maskCredentials === false && {
|
|
416
|
+
mask_credentials_disabled: true,
|
|
417
|
+
}),
|
|
412
418
|
},
|
|
413
419
|
api: {
|
|
414
420
|
...defaults,
|
package/src/options.ts
CHANGED
|
@@ -49,6 +49,7 @@ export const OptionsSchema = Joi.object({
|
|
|
49
49
|
markdownGenerators: markdownGenerators,
|
|
50
50
|
showSchemas: Joi.boolean(),
|
|
51
51
|
disableCompression: Joi.boolean(),
|
|
52
|
+
maskCredentials: Joi.boolean(),
|
|
52
53
|
version: Joi.string().when("versions", {
|
|
53
54
|
is: Joi.exist(),
|
|
54
55
|
then: Joi.required(),
|