docusaurus-plugin-openapi-docs 0.0.0-454 → 0.0.0-458
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 +2 -1
- package/lib/markdown/createRequestSchema.js +1 -1
- package/lib/markdown/createResponseSchema.js +1 -1
- package/lib/markdown/createStatusCodes.js +1 -1
- package/lib/openapi/openapi.js +6 -2
- package/package.json +2 -2
- package/src/index.ts +2 -1
- package/src/markdown/createRequestSchema.ts +1 -1
- package/src/markdown/createResponseSchema.ts +1 -1
- package/src/markdown/createStatusCodes.ts +1 -1
- package/src/openapi/openapi.ts +12 -2
package/lib/index.js
CHANGED
|
@@ -109,6 +109,7 @@ function pluginOpenAPIDocs(context, options) {
|
|
|
109
109
|
? fs_1.default.readFileSync(template).toString()
|
|
110
110
|
: `---
|
|
111
111
|
id: {{{id}}}
|
|
112
|
+
description: "{{{description}}}"
|
|
112
113
|
{{^api}}
|
|
113
114
|
sidebar_label: Introduction
|
|
114
115
|
{{/api}}
|
|
@@ -154,7 +155,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
154
155
|
const tagMdTemplate = `---
|
|
155
156
|
id: {{{id}}}
|
|
156
157
|
title: {{{description}}}
|
|
157
|
-
description: {{{description}}}
|
|
158
|
+
description: "{{{description}}}"
|
|
158
159
|
custom_edit_url: null
|
|
159
160
|
---
|
|
160
161
|
|
|
@@ -43,7 +43,7 @@ exports.mergeAllOf = mergeAllOf;
|
|
|
43
43
|
*/
|
|
44
44
|
function createAnyOneOf(schema) {
|
|
45
45
|
const type = schema.oneOf ? "oneOf" : "anyOf";
|
|
46
|
-
return (0, utils_1.create)("
|
|
46
|
+
return (0, utils_1.create)("div", {
|
|
47
47
|
children: [
|
|
48
48
|
(0, utils_1.create)("div", {
|
|
49
49
|
children: [
|
|
@@ -44,7 +44,7 @@ exports.mergeAllOf = mergeAllOf;
|
|
|
44
44
|
*/
|
|
45
45
|
function createAnyOneOf(schema) {
|
|
46
46
|
const type = schema.oneOf ? "oneOf" : "anyOf";
|
|
47
|
-
return (0, utils_1.create)("
|
|
47
|
+
return (0, utils_1.create)("div", {
|
|
48
48
|
children: [
|
|
49
49
|
(0, utils_1.create)("div", {
|
|
50
50
|
children: [
|
|
@@ -68,7 +68,7 @@ function createResponseHeaders(responseHeaders) {
|
|
|
68
68
|
Object.entries(responseHeaders).map(([headerName, headerObj]) => {
|
|
69
69
|
const { description, schema: { type }, example, } = headerObj;
|
|
70
70
|
return (0, utils_1.create)("li", {
|
|
71
|
-
|
|
71
|
+
className: "schemaItem",
|
|
72
72
|
children: [
|
|
73
73
|
(0, createDetailsSummary_1.createDetailsSummary)({
|
|
74
74
|
children: [
|
package/lib/openapi/openapi.js
CHANGED
|
@@ -95,7 +95,9 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
95
95
|
id: infoId,
|
|
96
96
|
unversionedId: infoId,
|
|
97
97
|
title: openapiData.info.title,
|
|
98
|
-
description: openapiData.info.description
|
|
98
|
+
description: openapiData.info.description
|
|
99
|
+
? openapiData.info.description.replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
|
|
100
|
+
: "",
|
|
99
101
|
frontMatter: {},
|
|
100
102
|
securitySchemes: (_b = openapiData.components) === null || _b === void 0 ? void 0 : _b.securitySchemes,
|
|
101
103
|
info: {
|
|
@@ -155,7 +157,9 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
155
157
|
infoId: infoId !== null && infoId !== void 0 ? infoId : "",
|
|
156
158
|
unversionedId: baseId,
|
|
157
159
|
title: title,
|
|
158
|
-
description: description
|
|
160
|
+
description: operationObject.description
|
|
161
|
+
? operationObject.description.replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
|
|
162
|
+
: "",
|
|
159
163
|
frontMatter: {},
|
|
160
164
|
api: {
|
|
161
165
|
...defaults,
|
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-458",
|
|
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": "1c9979d056ad00b54864147ccc3c78039cd774f5"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -143,6 +143,7 @@ export default function pluginOpenAPIDocs(
|
|
|
143
143
|
? fs.readFileSync(template).toString()
|
|
144
144
|
: `---
|
|
145
145
|
id: {{{id}}}
|
|
146
|
+
description: "{{{description}}}"
|
|
146
147
|
{{^api}}
|
|
147
148
|
sidebar_label: Introduction
|
|
148
149
|
{{/api}}
|
|
@@ -190,7 +191,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
190
191
|
const tagMdTemplate = `---
|
|
191
192
|
id: {{{id}}}
|
|
192
193
|
title: {{{description}}}
|
|
193
|
-
description: {{{description}}}
|
|
194
|
+
description: "{{{description}}}"
|
|
194
195
|
custom_edit_url: null
|
|
195
196
|
---
|
|
196
197
|
|
|
@@ -46,7 +46,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
|
|
|
46
46
|
*/
|
|
47
47
|
function createAnyOneOf(schema: SchemaObject): any {
|
|
48
48
|
const type = schema.oneOf ? "oneOf" : "anyOf";
|
|
49
|
-
return create("
|
|
49
|
+
return create("div", {
|
|
50
50
|
children: [
|
|
51
51
|
create("div", {
|
|
52
52
|
children: [
|
|
@@ -51,7 +51,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
|
|
|
51
51
|
*/
|
|
52
52
|
function createAnyOneOf(schema: SchemaObject): any {
|
|
53
53
|
const type = schema.oneOf ? "oneOf" : "anyOf";
|
|
54
|
-
return create("
|
|
54
|
+
return create("div", {
|
|
55
55
|
children: [
|
|
56
56
|
create("div", {
|
|
57
57
|
children: [
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -119,7 +119,12 @@ function createItems(
|
|
|
119
119
|
id: infoId,
|
|
120
120
|
unversionedId: infoId,
|
|
121
121
|
title: openapiData.info.title,
|
|
122
|
-
description: openapiData.info.description
|
|
122
|
+
description: openapiData.info.description
|
|
123
|
+
? openapiData.info.description.replace(
|
|
124
|
+
/((?:^|[^\\])(?:\\{2})*)"/g,
|
|
125
|
+
"$1'"
|
|
126
|
+
)
|
|
127
|
+
: "",
|
|
123
128
|
frontMatter: {},
|
|
124
129
|
securitySchemes: openapiData.components?.securitySchemes,
|
|
125
130
|
info: {
|
|
@@ -194,7 +199,12 @@ function createItems(
|
|
|
194
199
|
infoId: infoId ?? "",
|
|
195
200
|
unversionedId: baseId,
|
|
196
201
|
title: title,
|
|
197
|
-
description: description
|
|
202
|
+
description: operationObject.description
|
|
203
|
+
? operationObject.description.replace(
|
|
204
|
+
/((?:^|[^\\])(?:\\{2})*)"/g,
|
|
205
|
+
"$1'"
|
|
206
|
+
)
|
|
207
|
+
: "",
|
|
198
208
|
frontMatter: {},
|
|
199
209
|
api: {
|
|
200
210
|
...defaults,
|