docusaurus-theme-openapi-docs 0.0.0-beta.627 → 0.0.0-beta.628
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.
|
@@ -8,6 +8,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _themeCommon = require("@docusaurus/theme-common");
|
|
9
9
|
var _hooks = require("@theme/ApiItem/hooks");
|
|
10
10
|
var _CodeBlock = _interopRequireDefault(require("@theme/CodeBlock"));
|
|
11
|
+
var _SchemaTabs = _interopRequireDefault(require("@theme/SchemaTabs"));
|
|
12
|
+
var _TabItem = _interopRequireDefault(require("@theme/TabItem"));
|
|
13
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
14
|
var _slice = require("./slice");
|
|
12
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
16
|
/* ============================================================================
|
|
@@ -66,9 +69,31 @@ function Response() {
|
|
|
66
69
|
</button>
|
|
67
70
|
</div>
|
|
68
71
|
</summary>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
<div style={{
|
|
73
|
+
backgroundColor: prismTheme.plain.backgroundColor,
|
|
74
|
+
paddingLeft: "1rem",
|
|
75
|
+
paddingTop: "1rem",
|
|
76
|
+
...((prettyResponse === "Fetching..." || !code) && {
|
|
77
|
+
paddingBottom: "1rem"
|
|
78
|
+
})
|
|
79
|
+
}}>
|
|
80
|
+
{code && prettyResponse !== "Fetching..." ? <_SchemaTabs.default lazy>
|
|
81
|
+
{/* @ts-ignore */}
|
|
82
|
+
<_TabItem.default label={` ${code}`} value="body" attributes={{
|
|
83
|
+
className: (0, _clsx.default)("openapi-response__dot", responseStatusClass)
|
|
84
|
+
}} default>
|
|
85
|
+
<_CodeBlock.default className="openapi-demo__code-block openapi-response__status-code" language={response.startsWith("<") ? `xml` : `json`}>
|
|
86
|
+
{prettyResponse || "No Response"}
|
|
87
|
+
</_CodeBlock.default>
|
|
88
|
+
</_TabItem.default>
|
|
89
|
+
{/* @ts-ignore */}
|
|
90
|
+
<_TabItem.default label="Headers" value="headers">
|
|
91
|
+
<_CodeBlock.default className="openapi-demo__code-block openapi-response__status-headers" language={response.startsWith("<") ? `xml` : `json`}>
|
|
92
|
+
{JSON.stringify(headers, undefined, 2)}
|
|
93
|
+
</_CodeBlock.default>
|
|
94
|
+
</_TabItem.default>
|
|
95
|
+
</_SchemaTabs.default> : prettyResponse || "No Response"}
|
|
96
|
+
</div>
|
|
72
97
|
</details>;
|
|
73
98
|
}
|
|
74
99
|
var _default = Response;
|
|
@@ -9,6 +9,9 @@ import React from "react";
|
|
|
9
9
|
import { usePrismTheme } from "@docusaurus/theme-common";
|
|
10
10
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
11
11
|
import CodeBlock from "@theme/CodeBlock";
|
|
12
|
+
import SchemaTabs from "@theme/SchemaTabs";
|
|
13
|
+
import TabItem from "@theme/TabItem";
|
|
14
|
+
import clsx from "clsx";
|
|
12
15
|
import { clearResponse, clearCode, clearHeaders } from "./slice";
|
|
13
16
|
|
|
14
17
|
// TODO: We probably shouldn't attempt to format XML...
|
|
@@ -71,12 +74,48 @@ function Response() {
|
|
|
71
74
|
</button>
|
|
72
75
|
</div>
|
|
73
76
|
</summary>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
<div
|
|
78
|
+
style={{
|
|
79
|
+
backgroundColor: prismTheme.plain.backgroundColor,
|
|
80
|
+
paddingLeft: "1rem",
|
|
81
|
+
paddingTop: "1rem",
|
|
82
|
+
...((prettyResponse === "Fetching..." || !code) && {
|
|
83
|
+
paddingBottom: "1rem",
|
|
84
|
+
}),
|
|
85
|
+
}}
|
|
77
86
|
>
|
|
78
|
-
{prettyResponse
|
|
79
|
-
|
|
87
|
+
{code && prettyResponse !== "Fetching..." ? (
|
|
88
|
+
<SchemaTabs lazy>
|
|
89
|
+
{/* @ts-ignore */}
|
|
90
|
+
<TabItem
|
|
91
|
+
label={` ${code}`}
|
|
92
|
+
value="body"
|
|
93
|
+
attributes={{
|
|
94
|
+
className: clsx("openapi-response__dot", responseStatusClass),
|
|
95
|
+
}}
|
|
96
|
+
default
|
|
97
|
+
>
|
|
98
|
+
<CodeBlock
|
|
99
|
+
className="openapi-demo__code-block openapi-response__status-code"
|
|
100
|
+
language={response.startsWith("<") ? `xml` : `json`}
|
|
101
|
+
>
|
|
102
|
+
{prettyResponse || "No Response"}
|
|
103
|
+
</CodeBlock>
|
|
104
|
+
</TabItem>
|
|
105
|
+
{/* @ts-ignore */}
|
|
106
|
+
<TabItem label="Headers" value="headers">
|
|
107
|
+
<CodeBlock
|
|
108
|
+
className="openapi-demo__code-block openapi-response__status-headers"
|
|
109
|
+
language={response.startsWith("<") ? `xml` : `json`}
|
|
110
|
+
>
|
|
111
|
+
{JSON.stringify(headers, undefined, 2)}
|
|
112
|
+
</CodeBlock>
|
|
113
|
+
</TabItem>
|
|
114
|
+
</SchemaTabs>
|
|
115
|
+
) : (
|
|
116
|
+
prettyResponse || "No Response"
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
80
119
|
</details>
|
|
81
120
|
);
|
|
82
121
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-beta.
|
|
4
|
+
"version": "0.0.0-beta.628",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"buffer": "^6.0.3",
|
|
52
52
|
"clsx": "^1.1.1",
|
|
53
53
|
"crypto-js": "^4.1.1",
|
|
54
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-beta.
|
|
54
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-beta.628",
|
|
55
55
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
56
56
|
"file-saver": "^2.0.5",
|
|
57
57
|
"immer": "^9.0.7",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=14"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "f298c0e99839b0c704983b2a54e7cce0af593268"
|
|
80
80
|
}
|
|
@@ -81,12 +81,48 @@ function Response() {
|
|
|
81
81
|
</button>
|
|
82
82
|
</div>
|
|
83
83
|
</summary>
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
<div
|
|
85
|
+
style={{
|
|
86
|
+
backgroundColor: prismTheme.plain.backgroundColor,
|
|
87
|
+
paddingLeft: "1rem",
|
|
88
|
+
paddingTop: "1rem",
|
|
89
|
+
...((prettyResponse === "Fetching..." || !code) && {
|
|
90
|
+
paddingBottom: "1rem",
|
|
91
|
+
}),
|
|
92
|
+
}}
|
|
87
93
|
>
|
|
88
|
-
{prettyResponse
|
|
89
|
-
|
|
94
|
+
{code && prettyResponse !== "Fetching..." ? (
|
|
95
|
+
<SchemaTabs lazy>
|
|
96
|
+
{/* @ts-ignore */}
|
|
97
|
+
<TabItem
|
|
98
|
+
label={` ${code}`}
|
|
99
|
+
value="body"
|
|
100
|
+
attributes={{
|
|
101
|
+
className: clsx("openapi-response__dot", responseStatusClass),
|
|
102
|
+
}}
|
|
103
|
+
default
|
|
104
|
+
>
|
|
105
|
+
<CodeBlock
|
|
106
|
+
className="openapi-demo__code-block openapi-response__status-code"
|
|
107
|
+
language={response.startsWith("<") ? `xml` : `json`}
|
|
108
|
+
>
|
|
109
|
+
{prettyResponse || "No Response"}
|
|
110
|
+
</CodeBlock>
|
|
111
|
+
</TabItem>
|
|
112
|
+
{/* @ts-ignore */}
|
|
113
|
+
<TabItem label="Headers" value="headers">
|
|
114
|
+
<CodeBlock
|
|
115
|
+
className="openapi-demo__code-block openapi-response__status-headers"
|
|
116
|
+
language={response.startsWith("<") ? `xml` : `json`}
|
|
117
|
+
>
|
|
118
|
+
{JSON.stringify(headers, undefined, 2)}
|
|
119
|
+
</CodeBlock>
|
|
120
|
+
</TabItem>
|
|
121
|
+
</SchemaTabs>
|
|
122
|
+
) : (
|
|
123
|
+
prettyResponse || "No Response"
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
90
126
|
</details>
|
|
91
127
|
);
|
|
92
128
|
}
|