docusaurus-theme-openapi-docs 1.5.2 → 1.6.1
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 -11
- package/lib/markdown/utils.js +18 -1
- package/lib/theme/ApiDemoPanel/Curl/index.js +36 -9
- package/lib/theme/ApiDemoPanel/Curl/styles.module.css +5 -0
- package/lib/theme/ApiDemoPanel/Request/index.js +3 -2
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +195 -9
- package/lib/theme/ApiLogo/index.js +24 -1
- package/lib/theme/ApiTabs/index.js +7 -8
- package/lib/theme/ApiTabs/styles.module.css +5 -6
- package/lib/theme/ParamsItem/index.js +33 -6
- package/lib/theme/SchemaItem/index.js +10 -9
- package/lib/theme/styles.css +35 -1
- package/lib-next/index.js +2 -13
- package/lib-next/markdown/utils.js +17 -1
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +37 -8
- package/lib-next/theme/ApiDemoPanel/Curl/styles.module.css +5 -0
- package/lib-next/theme/ApiDemoPanel/Request/index.js +4 -2
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +210 -9
- package/lib-next/theme/ApiLogo/index.js +35 -9
- package/lib-next/theme/ApiTabs/index.js +7 -8
- package/lib-next/theme/ApiTabs/styles.module.css +5 -6
- package/lib-next/theme/ParamsItem/index.js +33 -6
- package/lib-next/theme/SchemaItem/index.js +10 -9
- package/lib-next/theme/styles.css +35 -1
- package/package.json +8 -7
- package/src/index.ts +3 -13
- package/src/markdown/utils.ts +18 -1
- package/src/theme/ApiDemoPanel/Curl/index.tsx +36 -8
- package/src/theme/ApiDemoPanel/Curl/styles.module.css +5 -0
- package/src/theme/ApiDemoPanel/Request/index.tsx +4 -2
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +213 -9
- package/src/theme/ApiLogo/index.tsx +37 -10
- package/src/theme/ApiTabs/index.js +7 -8
- package/src/theme/ApiTabs/styles.module.css +5 -6
- package/src/theme/ParamsItem/index.js +33 -6
- package/src/theme/SchemaItem/index.js +10 -9
- package/src/theme/styles.css +35 -1
package/lib/theme/styles.css
CHANGED
|
@@ -445,7 +445,41 @@
|
|
|
445
445
|
overflow: auto;
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
+
.code__tab--java::after {
|
|
449
|
+
content: "";
|
|
450
|
+
width: 28px;
|
|
451
|
+
height: 28px;
|
|
452
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/java/java-original.svg");
|
|
453
|
+
margin-block: auto;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.code__tab--java {
|
|
457
|
+
color: var(--ifm-color-warning);
|
|
458
|
+
padding-left: 1.4rem;
|
|
459
|
+
padding-right: 1.4rem;
|
|
460
|
+
padding-top: 1rem !important;
|
|
461
|
+
padding-bottom: 1rem !important;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.code__tab--java.tabs__item--active {
|
|
465
|
+
border-bottom-color: var(--ifm-color-warning);
|
|
466
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.language-java {
|
|
470
|
+
max-height: 500px;
|
|
471
|
+
overflow: auto;
|
|
472
|
+
}
|
|
473
|
+
|
|
448
474
|
/* Prism code styles */
|
|
449
|
-
.prism-code.language-
|
|
475
|
+
.prism-code.language-java {
|
|
450
476
|
white-space: pre !important;
|
|
451
477
|
}
|
|
478
|
+
|
|
479
|
+
.openapi__logo {
|
|
480
|
+
width: 250px;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
div:has(> ul.openapi-tabs__security-schemes) {
|
|
484
|
+
max-width: 100%;
|
|
485
|
+
}
|
package/lib-next/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
8
|
import path from "path";
|
|
9
|
-
|
|
9
|
+
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
|
|
10
10
|
export default function docusaurusThemeOpenAPI() {
|
|
11
11
|
return {
|
|
12
12
|
name: "docusaurus-theme-openapi",
|
|
@@ -22,18 +22,7 @@ export default function docusaurusThemeOpenAPI() {
|
|
|
22
22
|
},
|
|
23
23
|
configureWebpack() {
|
|
24
24
|
return {
|
|
25
|
-
plugins: [
|
|
26
|
-
new ProvidePlugin({
|
|
27
|
-
Buffer: [require.resolve("buffer/"), "Buffer"],
|
|
28
|
-
process: require.resolve("process/browser"),
|
|
29
|
-
}),
|
|
30
|
-
],
|
|
31
|
-
resolve: {
|
|
32
|
-
fallback: {
|
|
33
|
-
buffer: require.resolve("buffer/"),
|
|
34
|
-
process: require.resolve("process/browser"),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
25
|
+
plugins: [new NodePolyfillPlugin()],
|
|
37
26
|
};
|
|
38
27
|
},
|
|
39
28
|
};
|
|
@@ -14,7 +14,7 @@ export function create(tag, props) {
|
|
|
14
14
|
return `<${tag}${propString}>${render(children)}</${tag}>`;
|
|
15
15
|
}
|
|
16
16
|
export function guard(value, cb) {
|
|
17
|
-
if (value) {
|
|
17
|
+
if (!!value) {
|
|
18
18
|
const children = cb(value);
|
|
19
19
|
return render(children);
|
|
20
20
|
}
|
|
@@ -26,3 +26,19 @@ export function render(children) {
|
|
|
26
26
|
}
|
|
27
27
|
return children ?? "";
|
|
28
28
|
}
|
|
29
|
+
export function toString(value) {
|
|
30
|
+
// Return as-is if already string
|
|
31
|
+
if (typeof value === "string") {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
// Return undefined if null or undefined
|
|
35
|
+
if (value == null) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
// Return formatted array if Array
|
|
39
|
+
if (Array.isArray(value)) {
|
|
40
|
+
return `[${value.join(", ")}]`;
|
|
41
|
+
}
|
|
42
|
+
// Coerce to string in all other cases,
|
|
43
|
+
return value + "";
|
|
44
|
+
}
|
|
@@ -13,6 +13,7 @@ import CodeTabs from "@theme/ApiDemoPanel/CodeTabs";
|
|
|
13
13
|
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
14
14
|
import CodeBlock from "@theme/CodeBlock";
|
|
15
15
|
import clsx from "clsx";
|
|
16
|
+
import merge from "lodash/merge";
|
|
16
17
|
import styles from "./styles.module.css";
|
|
17
18
|
export const languageSet = [
|
|
18
19
|
{
|
|
@@ -87,6 +88,16 @@ export const languageSet = [
|
|
|
87
88
|
},
|
|
88
89
|
variant: "cURL",
|
|
89
90
|
},
|
|
91
|
+
{
|
|
92
|
+
highlight: "java",
|
|
93
|
+
language: "java",
|
|
94
|
+
logoClass: "java",
|
|
95
|
+
options: {
|
|
96
|
+
followRedirect: true,
|
|
97
|
+
trimRequestBody: true,
|
|
98
|
+
},
|
|
99
|
+
variant: "OkHttp",
|
|
100
|
+
},
|
|
90
101
|
];
|
|
91
102
|
function CodeTab({ children, hidden, className, onClick }) {
|
|
92
103
|
return (
|
|
@@ -115,20 +126,35 @@ function Curl({ postman, codeSamples }) {
|
|
|
115
126
|
const headerParams = useTypedSelector((state) => state.params.header);
|
|
116
127
|
const auth = useTypedSelector((state) => state.auth);
|
|
117
128
|
|
|
118
|
-
//
|
|
129
|
+
// User-defined languages array
|
|
130
|
+
// Can override languageSet, change order of langs, override options and variants
|
|
119
131
|
const langs = [
|
|
120
132
|
...(siteConfig?.themeConfig?.languageTabs ?? languageSet),
|
|
121
133
|
...codeSamples,
|
|
122
134
|
];
|
|
123
|
-
|
|
135
|
+
|
|
136
|
+
// Filter languageSet by user-defined langs
|
|
137
|
+
const filteredLanguageSet = languageSet.filter((ls) => {
|
|
138
|
+
return langs.some((lang) => {
|
|
139
|
+
return lang.language === ls.language;
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Merge user-defined langs into languageSet
|
|
144
|
+
const mergedLangs = merge(filteredLanguageSet, langs);
|
|
145
|
+
|
|
146
|
+
// Read defaultLang from localStorage
|
|
147
|
+
const defaultLang = mergedLangs.filter(
|
|
124
148
|
(lang) =>
|
|
125
149
|
lang.language === localStorage.getItem("docusaurus.tab.code-samples")
|
|
126
150
|
);
|
|
127
151
|
const [language, setLanguage] = useState(() => {
|
|
128
|
-
if
|
|
129
|
-
|
|
152
|
+
// Return first index if only 1 user-defined language exists
|
|
153
|
+
if (mergedLangs.length === 1) {
|
|
154
|
+
return mergedLangs[0];
|
|
130
155
|
}
|
|
131
|
-
|
|
156
|
+
// Fall back to language in localStorage or first user-defined language
|
|
157
|
+
return defaultLang[0] ?? mergedLangs[0];
|
|
132
158
|
});
|
|
133
159
|
const [codeText, setCodeText] = useState("");
|
|
134
160
|
useEffect(() => {
|
|
@@ -159,7 +185,7 @@ function Curl({ postman, codeSamples }) {
|
|
|
159
185
|
} else if (language && !!language.source) {
|
|
160
186
|
setCodeText(language.source);
|
|
161
187
|
} else if (language && !language.options) {
|
|
162
|
-
const langSource =
|
|
188
|
+
const langSource = mergedLangs.filter(
|
|
163
189
|
(lang) => lang.language === language.language
|
|
164
190
|
);
|
|
165
191
|
|
|
@@ -208,6 +234,7 @@ function Curl({ postman, codeSamples }) {
|
|
|
208
234
|
queryParams,
|
|
209
235
|
server,
|
|
210
236
|
auth,
|
|
237
|
+
mergedLangs,
|
|
211
238
|
]);
|
|
212
239
|
if (language === undefined) {
|
|
213
240
|
return null;
|
|
@@ -215,7 +242,7 @@ function Curl({ postman, codeSamples }) {
|
|
|
215
242
|
return (
|
|
216
243
|
<>
|
|
217
244
|
<CodeTabs groupId="code-samples" action={setLanguage}>
|
|
218
|
-
{
|
|
245
|
+
{mergedLangs.map((lang) => {
|
|
219
246
|
return (
|
|
220
247
|
<CodeTab
|
|
221
248
|
value={lang.language}
|
|
@@ -229,7 +256,9 @@ function Curl({ postman, codeSamples }) {
|
|
|
229
256
|
className: `code__tab--${lang.logoClass}`,
|
|
230
257
|
}}
|
|
231
258
|
>
|
|
232
|
-
<CodeBlock language={lang.highlight}
|
|
259
|
+
<CodeBlock language={lang.highlight} className={styles.codeBlock}>
|
|
260
|
+
{codeText}
|
|
261
|
+
</CodeBlock>
|
|
233
262
|
</CodeTab>
|
|
234
263
|
);
|
|
235
264
|
})}
|
|
@@ -20,7 +20,7 @@ function Request({ item }) {
|
|
|
20
20
|
const response = useTypedSelector((state) => state.response.value);
|
|
21
21
|
const postman = new sdk.Request(item.postman);
|
|
22
22
|
const metadata = useDoc();
|
|
23
|
-
const { proxy } = metadata.frontMatter;
|
|
23
|
+
const { proxy, hide_send_button } = metadata.frontMatter;
|
|
24
24
|
const params = {
|
|
25
25
|
path: [],
|
|
26
26
|
query: [],
|
|
@@ -38,7 +38,9 @@ function Request({ item }) {
|
|
|
38
38
|
<summary>
|
|
39
39
|
<div className={`details__request-summary`}>
|
|
40
40
|
<h4>Request</h4>
|
|
41
|
-
{item.servers &&
|
|
41
|
+
{item.servers && !hide_send_button && (
|
|
42
|
+
<Execute postman={postman} proxy={proxy} />
|
|
43
|
+
)}
|
|
42
44
|
</div>
|
|
43
45
|
</summary>
|
|
44
46
|
<div className={styles.optionsPanel}>
|
|
@@ -13,6 +13,9 @@ function SecuritySchemes(props) {
|
|
|
13
13
|
const selected = useTypedSelector((state) => state.auth.selected);
|
|
14
14
|
const infoAuthPath = `/${props.infoPath}#authentication`;
|
|
15
15
|
if (selected === undefined) return null;
|
|
16
|
+
if (options[selected]?.[0]?.type === undefined) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
16
19
|
const selectedAuth = options[selected];
|
|
17
20
|
return (
|
|
18
21
|
<details className={`details__demo-panel`} open={false}>
|
|
@@ -20,10 +23,93 @@ function SecuritySchemes(props) {
|
|
|
20
23
|
<h4>Authorization</h4>
|
|
21
24
|
</summary>
|
|
22
25
|
{selectedAuth.map((auth) => {
|
|
26
|
+
const isHttp = auth.type === "http";
|
|
23
27
|
const isApiKey = auth.type === "apiKey";
|
|
24
|
-
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
25
28
|
const isOauth2 = auth.type === "oauth2";
|
|
26
|
-
|
|
29
|
+
const isOpenId = auth.type === "openIdConnect";
|
|
30
|
+
if (isHttp) {
|
|
31
|
+
if (auth.scheme === "bearer") {
|
|
32
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
33
|
+
return (
|
|
34
|
+
<React.Fragment key={auth.key}>
|
|
35
|
+
<pre
|
|
36
|
+
style={{
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
background: "var(--openapi-card-background-color)",
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<span>
|
|
43
|
+
<strong>name:</strong>{" "}
|
|
44
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
45
|
+
</span>
|
|
46
|
+
<span>
|
|
47
|
+
<strong>type: </strong>
|
|
48
|
+
{type}
|
|
49
|
+
</span>
|
|
50
|
+
{scopes && scopes.length > 0 && (
|
|
51
|
+
<span>
|
|
52
|
+
<strong>scopes: </strong>
|
|
53
|
+
<code>
|
|
54
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
55
|
+
</code>
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
{Object.keys(rest).map((k, i) => {
|
|
59
|
+
return (
|
|
60
|
+
<span key={k}>
|
|
61
|
+
<strong>{k}: </strong>
|
|
62
|
+
{typeof rest[k] === "object"
|
|
63
|
+
? JSON.stringify(rest[k], null, 2)
|
|
64
|
+
: String(rest[k])}
|
|
65
|
+
</span>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</pre>
|
|
69
|
+
</React.Fragment>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (auth.scheme === "basic") {
|
|
73
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
74
|
+
return (
|
|
75
|
+
<React.Fragment key={auth.key}>
|
|
76
|
+
<pre
|
|
77
|
+
style={{
|
|
78
|
+
display: "flex",
|
|
79
|
+
flexDirection: "column",
|
|
80
|
+
background: "var(--openapi-card-background-color)",
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<span>
|
|
84
|
+
<strong>name:</strong>{" "}
|
|
85
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
86
|
+
</span>
|
|
87
|
+
<span>
|
|
88
|
+
<strong>type: </strong>
|
|
89
|
+
{type}
|
|
90
|
+
</span>
|
|
91
|
+
{scopes && scopes.length > 0 && (
|
|
92
|
+
<span>
|
|
93
|
+
<strong>scopes: </strong>
|
|
94
|
+
<code>
|
|
95
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
96
|
+
</code>
|
|
97
|
+
</span>
|
|
98
|
+
)}
|
|
99
|
+
{Object.keys(rest).map((k, i) => {
|
|
100
|
+
return (
|
|
101
|
+
<span key={k}>
|
|
102
|
+
<strong>{k}: </strong>
|
|
103
|
+
{typeof rest[k] === "object"
|
|
104
|
+
? JSON.stringify(rest[k], null, 2)
|
|
105
|
+
: String(rest[k])}
|
|
106
|
+
</span>
|
|
107
|
+
);
|
|
108
|
+
})}
|
|
109
|
+
</pre>
|
|
110
|
+
</React.Fragment>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
27
113
|
return (
|
|
28
114
|
<React.Fragment key={auth.key}>
|
|
29
115
|
<pre
|
|
@@ -33,16 +119,65 @@ function SecuritySchemes(props) {
|
|
|
33
119
|
background: "var(--openapi-card-background-color)",
|
|
34
120
|
}}
|
|
35
121
|
>
|
|
36
|
-
<span>type: {auth.type}</span>
|
|
37
122
|
<span>
|
|
38
|
-
|
|
123
|
+
<strong>name:</strong>{" "}
|
|
124
|
+
<Link to={infoAuthPath}>{auth.name ?? auth.key}</Link>
|
|
39
125
|
</span>
|
|
40
|
-
<span>
|
|
126
|
+
<span>
|
|
127
|
+
<strong>type: </strong>
|
|
128
|
+
{auth.type}
|
|
129
|
+
</span>
|
|
130
|
+
<span>
|
|
131
|
+
<strong>in: </strong>
|
|
132
|
+
{auth.in}
|
|
133
|
+
</span>
|
|
134
|
+
</pre>
|
|
135
|
+
</React.Fragment>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (isApiKey) {
|
|
139
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
140
|
+
return (
|
|
141
|
+
<React.Fragment key={auth.key}>
|
|
142
|
+
<pre
|
|
143
|
+
style={{
|
|
144
|
+
display: "flex",
|
|
145
|
+
flexDirection: "column",
|
|
146
|
+
background: "var(--openapi-card-background-color)",
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<span>
|
|
150
|
+
<strong>name:</strong>{" "}
|
|
151
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
152
|
+
</span>
|
|
153
|
+
<span>
|
|
154
|
+
<strong>type: </strong>
|
|
155
|
+
{type}
|
|
156
|
+
</span>
|
|
157
|
+
{scopes && scopes.length > 0 && (
|
|
158
|
+
<span>
|
|
159
|
+
<strong>scopes: </strong>
|
|
160
|
+
<code>
|
|
161
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
162
|
+
</code>
|
|
163
|
+
</span>
|
|
164
|
+
)}
|
|
165
|
+
{Object.keys(rest).map((k, i) => {
|
|
166
|
+
return (
|
|
167
|
+
<span key={k}>
|
|
168
|
+
<strong>{k}: </strong>
|
|
169
|
+
{typeof rest[k] === "object"
|
|
170
|
+
? JSON.stringify(rest[k], null, 2)
|
|
171
|
+
: String(rest[k])}
|
|
172
|
+
</span>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
41
175
|
</pre>
|
|
42
176
|
</React.Fragment>
|
|
43
177
|
);
|
|
44
178
|
}
|
|
45
179
|
if (isOauth2) {
|
|
180
|
+
const { name, key, type, scopes, flows, ...rest } = auth;
|
|
46
181
|
return (
|
|
47
182
|
<React.Fragment key={selected}>
|
|
48
183
|
<pre
|
|
@@ -53,14 +188,80 @@ function SecuritySchemes(props) {
|
|
|
53
188
|
}}
|
|
54
189
|
>
|
|
55
190
|
<span>
|
|
56
|
-
|
|
191
|
+
<strong>name:</strong>{" "}
|
|
192
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
57
193
|
</span>
|
|
58
|
-
|
|
59
|
-
|
|
194
|
+
<span>
|
|
195
|
+
<strong>type: </strong>
|
|
196
|
+
{type}
|
|
197
|
+
</span>
|
|
198
|
+
{scopes && scopes.length > 0 && (
|
|
199
|
+
<span>
|
|
200
|
+
<strong>scopes: </strong>
|
|
201
|
+
<code>
|
|
202
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
203
|
+
</code>
|
|
204
|
+
</span>
|
|
205
|
+
)}
|
|
206
|
+
{Object.keys(rest).map((k, i) => {
|
|
207
|
+
return (
|
|
208
|
+
<span key={k}>
|
|
209
|
+
<strong>{k}: </strong>
|
|
210
|
+
{typeof rest[k] === "object"
|
|
211
|
+
? JSON.stringify(rest[k], null, 2)
|
|
212
|
+
: String(rest[k])}
|
|
213
|
+
</span>
|
|
214
|
+
);
|
|
60
215
|
})}
|
|
216
|
+
{flows && (
|
|
217
|
+
<span>
|
|
218
|
+
<code>
|
|
219
|
+
<strong>flows: </strong>
|
|
220
|
+
{JSON.stringify(flows, null, 2)}
|
|
221
|
+
</code>
|
|
222
|
+
</span>
|
|
223
|
+
)}
|
|
224
|
+
</pre>
|
|
225
|
+
</React.Fragment>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (isOpenId) {
|
|
229
|
+
const { name, key, scopes, type, ...rest } = auth;
|
|
230
|
+
return (
|
|
231
|
+
<React.Fragment key={auth.key}>
|
|
232
|
+
<pre
|
|
233
|
+
style={{
|
|
234
|
+
display: "flex",
|
|
235
|
+
flexDirection: "column",
|
|
236
|
+
background: "var(--openapi-card-background-color)",
|
|
237
|
+
}}
|
|
238
|
+
>
|
|
61
239
|
<span>
|
|
62
|
-
|
|
240
|
+
<strong>name:</strong>{" "}
|
|
241
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
63
242
|
</span>
|
|
243
|
+
<span>
|
|
244
|
+
<strong>type: </strong>
|
|
245
|
+
{type}
|
|
246
|
+
</span>
|
|
247
|
+
{scopes && scopes.length > 0 && (
|
|
248
|
+
<span>
|
|
249
|
+
<strong>scopes: </strong>
|
|
250
|
+
<code>
|
|
251
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
252
|
+
</code>
|
|
253
|
+
</span>
|
|
254
|
+
)}
|
|
255
|
+
{Object.keys(rest).map((k, i) => {
|
|
256
|
+
return (
|
|
257
|
+
<span key={k}>
|
|
258
|
+
<strong>{k}: </strong>
|
|
259
|
+
{typeof rest[k] === "object"
|
|
260
|
+
? JSON.stringify(rest[k], null, 2)
|
|
261
|
+
: String(rest[k])}
|
|
262
|
+
</span>
|
|
263
|
+
);
|
|
264
|
+
})}
|
|
64
265
|
</pre>
|
|
65
266
|
</React.Fragment>
|
|
66
267
|
);
|
|
@@ -7,16 +7,42 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { useColorMode } from "@docusaurus/theme-common";
|
|
10
|
+
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
11
|
+
import ThemedImage from "@theme/ThemedImage";
|
|
10
12
|
export default function ApiLogo(props) {
|
|
11
13
|
const { colorMode } = useColorMode();
|
|
12
14
|
const { logo, darkLogo } = props;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
15
|
+
const altText = () => {
|
|
16
|
+
if (colorMode === "dark") {
|
|
17
|
+
return darkLogo?.altText ?? logo?.altText;
|
|
18
|
+
}
|
|
19
|
+
return logo?.altText;
|
|
20
|
+
};
|
|
21
|
+
const lightLogoUrl = useBaseUrl(logo?.url);
|
|
22
|
+
const darkLogoUrl = useBaseUrl(darkLogo?.url);
|
|
23
|
+
if (logo && darkLogo) {
|
|
24
|
+
return (
|
|
25
|
+
<ThemedImage
|
|
26
|
+
alt={altText()}
|
|
27
|
+
sources={{
|
|
28
|
+
light: lightLogoUrl,
|
|
29
|
+
dark: darkLogoUrl,
|
|
30
|
+
}}
|
|
31
|
+
className="openapi__logo"
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
if (logo || darkLogo) {
|
|
36
|
+
return (
|
|
37
|
+
<ThemedImage
|
|
38
|
+
alt={altText()}
|
|
39
|
+
sources={{
|
|
40
|
+
light: lightLogoUrl ?? darkLogoUrl,
|
|
41
|
+
dark: lightLogoUrl ?? darkLogoUrl,
|
|
42
|
+
}}
|
|
43
|
+
className="openapi__logo"
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
22
48
|
}
|
|
@@ -188,12 +188,12 @@ function ApiTabsComponent(props) {
|
|
|
188
188
|
)}
|
|
189
189
|
>
|
|
190
190
|
{values.map(({ value, label, attributes }) => {
|
|
191
|
-
const
|
|
191
|
+
const responseStatusStyle =
|
|
192
192
|
parseInt(value) >= 400
|
|
193
|
-
? styles.
|
|
193
|
+
? styles.responseStatusDanger
|
|
194
194
|
: parseInt(value) >= 200 && parseInt(value) < 300
|
|
195
|
-
? styles.
|
|
196
|
-
: styles.
|
|
195
|
+
? styles.responseStatusSuccess
|
|
196
|
+
: styles.responseStatusInfo;
|
|
197
197
|
|
|
198
198
|
return (
|
|
199
199
|
<li
|
|
@@ -210,14 +210,13 @@ function ApiTabsComponent(props) {
|
|
|
210
210
|
"tabs__item",
|
|
211
211
|
styles.tabItem,
|
|
212
212
|
attributes?.className,
|
|
213
|
+
responseStatusStyle,
|
|
213
214
|
{
|
|
214
|
-
[styles.
|
|
215
|
+
[styles.active]: selectedValue === value,
|
|
215
216
|
}
|
|
216
217
|
)}
|
|
217
218
|
>
|
|
218
|
-
<div
|
|
219
|
-
className={clsx(styles.responseTabDot, responseTabDotStyle)}
|
|
220
|
-
/>
|
|
219
|
+
<div className={styles.responseTabDot} />
|
|
221
220
|
{label ?? value}
|
|
222
221
|
</li>
|
|
223
222
|
);
|
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
font-weight: var(--ifm-font-weight-normal);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.tabItem:not(.
|
|
21
|
+
.tabItem:not(.active) {
|
|
22
22
|
opacity: 0.65;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.tabItem:hover {
|
|
26
26
|
opacity: 1;
|
|
27
|
-
background-color: var(--ifm-color-emphasis-100);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
.tabItem:last-child {
|
|
@@ -66,19 +65,19 @@
|
|
|
66
65
|
border-radius: 50%;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
.
|
|
68
|
+
.responseStatusSuccess > .responseTabDot {
|
|
70
69
|
background-color: var(--ifm-color-success);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
.
|
|
72
|
+
.responseStatusDanger > .responseTabDot {
|
|
74
73
|
background-color: var(--ifm-color-danger);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
.
|
|
76
|
+
.responseStatusInfo > .responseTabDot {
|
|
78
77
|
background-color: var(--ifm-color-info);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
.
|
|
80
|
+
.active {
|
|
82
81
|
background-color: var(--ifm-color-emphasis-100);
|
|
83
82
|
}
|
|
84
83
|
|