docusaurus-theme-openapi-docs 0.0.0-567 → 0.0.0-570
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/theme/ApiDemoPanel/SecuritySchemes/index.js +195 -9
- package/lib/theme/ParamsItem/index.js +4 -0
- package/lib/theme/styles.css +4 -0
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +200 -9
- package/lib-next/theme/ParamsItem/index.js +4 -0
- package/lib-next/theme/styles.css +4 -0
- package/package.json +3 -3
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +203 -9
- package/src/theme/ParamsItem/index.js +4 -0
- package/src/theme/styles.css +4 -0
|
@@ -16,35 +16,167 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
16
|
* ========================================================================== */
|
|
17
17
|
|
|
18
18
|
function SecuritySchemes(props) {
|
|
19
|
+
var _options$selected, _options$selected$;
|
|
19
20
|
const options = (0, _hooks.useTypedSelector)(state => state.auth.options);
|
|
20
21
|
const selected = (0, _hooks.useTypedSelector)(state => state.auth.selected);
|
|
21
22
|
const infoAuthPath = `/${props.infoPath}#authentication`;
|
|
22
23
|
if (selected === undefined) return null;
|
|
24
|
+
if (((_options$selected = options[selected]) === null || _options$selected === void 0 ? void 0 : (_options$selected$ = _options$selected[0]) === null || _options$selected$ === void 0 ? void 0 : _options$selected$.type) === undefined) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
23
27
|
const selectedAuth = options[selected];
|
|
24
28
|
return <details className={`details__demo-panel`} open={false}>
|
|
25
29
|
<summary className={`details__request-summary`}>
|
|
26
30
|
<h4>Authorization</h4>
|
|
27
31
|
</summary>
|
|
28
32
|
{selectedAuth.map(auth => {
|
|
33
|
+
const isHttp = auth.type === "http";
|
|
29
34
|
const isApiKey = auth.type === "apiKey";
|
|
30
|
-
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
31
35
|
const isOauth2 = auth.type === "oauth2";
|
|
32
|
-
|
|
36
|
+
const isOpenId = auth.type === "openIdConnect";
|
|
37
|
+
if (isHttp) {
|
|
38
|
+
var _auth$name;
|
|
39
|
+
if (auth.scheme === "bearer") {
|
|
40
|
+
const {
|
|
41
|
+
name,
|
|
42
|
+
key,
|
|
43
|
+
type,
|
|
44
|
+
scopes,
|
|
45
|
+
...rest
|
|
46
|
+
} = auth;
|
|
47
|
+
return <_react.default.Fragment key={auth.key}>
|
|
48
|
+
<pre style={{
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
background: "var(--openapi-card-background-color)"
|
|
52
|
+
}}>
|
|
53
|
+
<span>
|
|
54
|
+
<strong>name:</strong>{" "}
|
|
55
|
+
<_Link.default to={infoAuthPath}>{name !== null && name !== void 0 ? name : key}</_Link.default>
|
|
56
|
+
</span>
|
|
57
|
+
<span>
|
|
58
|
+
<strong>type: </strong>
|
|
59
|
+
{type}
|
|
60
|
+
</span>
|
|
61
|
+
{scopes && scopes.length > 0 && <span>
|
|
62
|
+
<strong>scopes: </strong>
|
|
63
|
+
<code>
|
|
64
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
65
|
+
</code>
|
|
66
|
+
</span>}
|
|
67
|
+
{Object.keys(rest).map((k, i) => {
|
|
68
|
+
return <span key={k}>
|
|
69
|
+
<strong>{k}: </strong>
|
|
70
|
+
{rest[k]}
|
|
71
|
+
</span>;
|
|
72
|
+
})}
|
|
73
|
+
</pre>
|
|
74
|
+
</_react.default.Fragment>;
|
|
75
|
+
}
|
|
76
|
+
if (auth.scheme === "basic") {
|
|
77
|
+
const {
|
|
78
|
+
name,
|
|
79
|
+
key,
|
|
80
|
+
type,
|
|
81
|
+
scopes,
|
|
82
|
+
...rest
|
|
83
|
+
} = auth;
|
|
84
|
+
return <_react.default.Fragment key={auth.key}>
|
|
85
|
+
<pre style={{
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexDirection: "column",
|
|
88
|
+
background: "var(--openapi-card-background-color)"
|
|
89
|
+
}}>
|
|
90
|
+
<span>
|
|
91
|
+
<strong>name:</strong>{" "}
|
|
92
|
+
<_Link.default to={infoAuthPath}>{name !== null && name !== void 0 ? name : key}</_Link.default>
|
|
93
|
+
</span>
|
|
94
|
+
<span>
|
|
95
|
+
<strong>type: </strong>
|
|
96
|
+
{type}
|
|
97
|
+
</span>
|
|
98
|
+
{scopes && scopes.length > 0 && <span>
|
|
99
|
+
<strong>scopes: </strong>
|
|
100
|
+
<code>
|
|
101
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
102
|
+
</code>
|
|
103
|
+
</span>}
|
|
104
|
+
{Object.keys(rest).map((k, i) => {
|
|
105
|
+
return <span key={k}>
|
|
106
|
+
<strong>{k}: </strong>
|
|
107
|
+
{rest[k]}
|
|
108
|
+
</span>;
|
|
109
|
+
})}
|
|
110
|
+
</pre>
|
|
111
|
+
</_react.default.Fragment>;
|
|
112
|
+
}
|
|
33
113
|
return <_react.default.Fragment key={auth.key}>
|
|
34
114
|
<pre style={{
|
|
35
115
|
display: "flex",
|
|
36
116
|
flexDirection: "column",
|
|
37
117
|
background: "var(--openapi-card-background-color)"
|
|
38
118
|
}}>
|
|
39
|
-
<span>type: {auth.type}</span>
|
|
40
119
|
<span>
|
|
41
|
-
|
|
120
|
+
<strong>name:</strong>{" "}
|
|
121
|
+
<_Link.default to={infoAuthPath}>{(_auth$name = auth.name) !== null && _auth$name !== void 0 ? _auth$name : auth.key}</_Link.default>
|
|
42
122
|
</span>
|
|
43
|
-
<span>
|
|
123
|
+
<span>
|
|
124
|
+
<strong>type: </strong>
|
|
125
|
+
{auth.type}
|
|
126
|
+
</span>
|
|
127
|
+
<span>
|
|
128
|
+
<strong>in: </strong>
|
|
129
|
+
{auth.in}
|
|
130
|
+
</span>
|
|
131
|
+
</pre>
|
|
132
|
+
</_react.default.Fragment>;
|
|
133
|
+
}
|
|
134
|
+
if (isApiKey) {
|
|
135
|
+
const {
|
|
136
|
+
name,
|
|
137
|
+
key,
|
|
138
|
+
type,
|
|
139
|
+
scopes,
|
|
140
|
+
...rest
|
|
141
|
+
} = auth;
|
|
142
|
+
return <_react.default.Fragment key={auth.key}>
|
|
143
|
+
<pre style={{
|
|
144
|
+
display: "flex",
|
|
145
|
+
flexDirection: "column",
|
|
146
|
+
background: "var(--openapi-card-background-color)"
|
|
147
|
+
}}>
|
|
148
|
+
<span>
|
|
149
|
+
<strong>name:</strong>{" "}
|
|
150
|
+
<_Link.default to={infoAuthPath}>{name !== null && name !== void 0 ? name : key}</_Link.default>
|
|
151
|
+
</span>
|
|
152
|
+
<span>
|
|
153
|
+
<strong>type: </strong>
|
|
154
|
+
{type}
|
|
155
|
+
</span>
|
|
156
|
+
{scopes && scopes.length > 0 && <span>
|
|
157
|
+
<strong>scopes: </strong>
|
|
158
|
+
<code>
|
|
159
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
160
|
+
</code>
|
|
161
|
+
</span>}
|
|
162
|
+
{Object.keys(rest).map((k, i) => {
|
|
163
|
+
return <span key={k}>
|
|
164
|
+
<strong>{k}: </strong>
|
|
165
|
+
{rest[k]}
|
|
166
|
+
</span>;
|
|
167
|
+
})}
|
|
44
168
|
</pre>
|
|
45
169
|
</_react.default.Fragment>;
|
|
46
170
|
}
|
|
47
171
|
if (isOauth2) {
|
|
172
|
+
const {
|
|
173
|
+
name,
|
|
174
|
+
key,
|
|
175
|
+
type,
|
|
176
|
+
scopes,
|
|
177
|
+
flows,
|
|
178
|
+
...rest
|
|
179
|
+
} = auth;
|
|
48
180
|
return <_react.default.Fragment key={selected}>
|
|
49
181
|
<pre style={{
|
|
50
182
|
display: "flex",
|
|
@@ -52,14 +184,68 @@ function SecuritySchemes(props) {
|
|
|
52
184
|
background: "var(--openapi-card-background-color)"
|
|
53
185
|
}}>
|
|
54
186
|
<span>
|
|
55
|
-
|
|
187
|
+
<strong>name:</strong>{" "}
|
|
188
|
+
<_Link.default to={infoAuthPath}>{name !== null && name !== void 0 ? name : key}</_Link.default>
|
|
189
|
+
</span>
|
|
190
|
+
<span>
|
|
191
|
+
<strong>type: </strong>
|
|
192
|
+
{type}
|
|
56
193
|
</span>
|
|
57
|
-
{
|
|
58
|
-
|
|
194
|
+
{scopes && scopes.length > 0 && <span>
|
|
195
|
+
<strong>scopes: </strong>
|
|
196
|
+
<code>
|
|
197
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
198
|
+
</code>
|
|
199
|
+
</span>}
|
|
200
|
+
{Object.keys(rest).map((k, i) => {
|
|
201
|
+
return <span key={k}>
|
|
202
|
+
<strong>{k}: </strong>
|
|
203
|
+
{rest[k]}
|
|
204
|
+
</span>;
|
|
59
205
|
})}
|
|
206
|
+
{flows && <span>
|
|
207
|
+
<code>
|
|
208
|
+
<strong>flows: </strong>
|
|
209
|
+
{JSON.stringify(flows, null, 2)}
|
|
210
|
+
</code>
|
|
211
|
+
</span>}
|
|
212
|
+
</pre>
|
|
213
|
+
</_react.default.Fragment>;
|
|
214
|
+
}
|
|
215
|
+
if (isOpenId) {
|
|
216
|
+
const {
|
|
217
|
+
name,
|
|
218
|
+
key,
|
|
219
|
+
scopes,
|
|
220
|
+
type,
|
|
221
|
+
...rest
|
|
222
|
+
} = auth;
|
|
223
|
+
return <_react.default.Fragment key={auth.key}>
|
|
224
|
+
<pre style={{
|
|
225
|
+
display: "flex",
|
|
226
|
+
flexDirection: "column",
|
|
227
|
+
background: "var(--openapi-card-background-color)"
|
|
228
|
+
}}>
|
|
229
|
+
<span>
|
|
230
|
+
<strong>name:</strong>{" "}
|
|
231
|
+
<_Link.default to={infoAuthPath}>{name !== null && name !== void 0 ? name : key}</_Link.default>
|
|
232
|
+
</span>
|
|
60
233
|
<span>
|
|
61
|
-
|
|
234
|
+
<strong>type: </strong>
|
|
235
|
+
{type}
|
|
62
236
|
</span>
|
|
237
|
+
{scopes && scopes.length > 0 && <span>
|
|
238
|
+
<strong>scopes: </strong>
|
|
239
|
+
<code>
|
|
240
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
241
|
+
</code>
|
|
242
|
+
</span>}
|
|
243
|
+
{Object.keys(rest).map((k, i) => {
|
|
244
|
+
return <span key={k}>
|
|
245
|
+
<strong>{k}: </strong>
|
|
246
|
+
{rest[k]}
|
|
247
|
+
</span>;
|
|
248
|
+
})}
|
|
63
249
|
</pre>
|
|
64
250
|
</_react.default.Fragment>;
|
|
65
251
|
}
|
|
@@ -30,6 +30,10 @@ import styles from "./styles.module.css";
|
|
|
30
30
|
function ParamsItem({
|
|
31
31
|
param: { description, example, examples, name, required, schema },
|
|
32
32
|
}) {
|
|
33
|
+
if (!schema || !schema?.type) {
|
|
34
|
+
schema = { type: "any" };
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
const renderSchemaName = guard(schema, (schema) => (
|
|
34
38
|
<span className={styles.schemaName}> {getSchemaName(schema)}</span>
|
|
35
39
|
));
|
package/lib/theme/styles.css
CHANGED
|
@@ -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,89 @@ 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
|
+
{rest[k]}
|
|
63
|
+
</span>
|
|
64
|
+
);
|
|
65
|
+
})}
|
|
66
|
+
</pre>
|
|
67
|
+
</React.Fragment>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (auth.scheme === "basic") {
|
|
71
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
72
|
+
return (
|
|
73
|
+
<React.Fragment key={auth.key}>
|
|
74
|
+
<pre
|
|
75
|
+
style={{
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
background: "var(--openapi-card-background-color)",
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<span>
|
|
82
|
+
<strong>name:</strong>{" "}
|
|
83
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
84
|
+
</span>
|
|
85
|
+
<span>
|
|
86
|
+
<strong>type: </strong>
|
|
87
|
+
{type}
|
|
88
|
+
</span>
|
|
89
|
+
{scopes && scopes.length > 0 && (
|
|
90
|
+
<span>
|
|
91
|
+
<strong>scopes: </strong>
|
|
92
|
+
<code>
|
|
93
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
94
|
+
</code>
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
{Object.keys(rest).map((k, i) => {
|
|
98
|
+
return (
|
|
99
|
+
<span key={k}>
|
|
100
|
+
<strong>{k}: </strong>
|
|
101
|
+
{rest[k]}
|
|
102
|
+
</span>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</pre>
|
|
106
|
+
</React.Fragment>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
27
109
|
return (
|
|
28
110
|
<React.Fragment key={auth.key}>
|
|
29
111
|
<pre
|
|
@@ -33,16 +115,63 @@ function SecuritySchemes(props) {
|
|
|
33
115
|
background: "var(--openapi-card-background-color)",
|
|
34
116
|
}}
|
|
35
117
|
>
|
|
36
|
-
<span>type: {auth.type}</span>
|
|
37
118
|
<span>
|
|
38
|
-
|
|
119
|
+
<strong>name:</strong>{" "}
|
|
120
|
+
<Link to={infoAuthPath}>{auth.name ?? auth.key}</Link>
|
|
39
121
|
</span>
|
|
40
|
-
<span>
|
|
122
|
+
<span>
|
|
123
|
+
<strong>type: </strong>
|
|
124
|
+
{auth.type}
|
|
125
|
+
</span>
|
|
126
|
+
<span>
|
|
127
|
+
<strong>in: </strong>
|
|
128
|
+
{auth.in}
|
|
129
|
+
</span>
|
|
130
|
+
</pre>
|
|
131
|
+
</React.Fragment>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (isApiKey) {
|
|
135
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
136
|
+
return (
|
|
137
|
+
<React.Fragment key={auth.key}>
|
|
138
|
+
<pre
|
|
139
|
+
style={{
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
background: "var(--openapi-card-background-color)",
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
<span>
|
|
146
|
+
<strong>name:</strong>{" "}
|
|
147
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
148
|
+
</span>
|
|
149
|
+
<span>
|
|
150
|
+
<strong>type: </strong>
|
|
151
|
+
{type}
|
|
152
|
+
</span>
|
|
153
|
+
{scopes && scopes.length > 0 && (
|
|
154
|
+
<span>
|
|
155
|
+
<strong>scopes: </strong>
|
|
156
|
+
<code>
|
|
157
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
158
|
+
</code>
|
|
159
|
+
</span>
|
|
160
|
+
)}
|
|
161
|
+
{Object.keys(rest).map((k, i) => {
|
|
162
|
+
return (
|
|
163
|
+
<span key={k}>
|
|
164
|
+
<strong>{k}: </strong>
|
|
165
|
+
{rest[k]}
|
|
166
|
+
</span>
|
|
167
|
+
);
|
|
168
|
+
})}
|
|
41
169
|
</pre>
|
|
42
170
|
</React.Fragment>
|
|
43
171
|
);
|
|
44
172
|
}
|
|
45
173
|
if (isOauth2) {
|
|
174
|
+
const { name, key, type, scopes, flows, ...rest } = auth;
|
|
46
175
|
return (
|
|
47
176
|
<React.Fragment key={selected}>
|
|
48
177
|
<pre
|
|
@@ -53,14 +182,76 @@ function SecuritySchemes(props) {
|
|
|
53
182
|
}}
|
|
54
183
|
>
|
|
55
184
|
<span>
|
|
56
|
-
|
|
185
|
+
<strong>name:</strong>{" "}
|
|
186
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
57
187
|
</span>
|
|
58
|
-
|
|
59
|
-
|
|
188
|
+
<span>
|
|
189
|
+
<strong>type: </strong>
|
|
190
|
+
{type}
|
|
191
|
+
</span>
|
|
192
|
+
{scopes && scopes.length > 0 && (
|
|
193
|
+
<span>
|
|
194
|
+
<strong>scopes: </strong>
|
|
195
|
+
<code>
|
|
196
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
197
|
+
</code>
|
|
198
|
+
</span>
|
|
199
|
+
)}
|
|
200
|
+
{Object.keys(rest).map((k, i) => {
|
|
201
|
+
return (
|
|
202
|
+
<span key={k}>
|
|
203
|
+
<strong>{k}: </strong>
|
|
204
|
+
{rest[k]}
|
|
205
|
+
</span>
|
|
206
|
+
);
|
|
60
207
|
})}
|
|
208
|
+
{flows && (
|
|
209
|
+
<span>
|
|
210
|
+
<code>
|
|
211
|
+
<strong>flows: </strong>
|
|
212
|
+
{JSON.stringify(flows, null, 2)}
|
|
213
|
+
</code>
|
|
214
|
+
</span>
|
|
215
|
+
)}
|
|
216
|
+
</pre>
|
|
217
|
+
</React.Fragment>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
if (isOpenId) {
|
|
221
|
+
const { name, key, scopes, type, ...rest } = auth;
|
|
222
|
+
return (
|
|
223
|
+
<React.Fragment key={auth.key}>
|
|
224
|
+
<pre
|
|
225
|
+
style={{
|
|
226
|
+
display: "flex",
|
|
227
|
+
flexDirection: "column",
|
|
228
|
+
background: "var(--openapi-card-background-color)",
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
61
231
|
<span>
|
|
62
|
-
|
|
232
|
+
<strong>name:</strong>{" "}
|
|
233
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
63
234
|
</span>
|
|
235
|
+
<span>
|
|
236
|
+
<strong>type: </strong>
|
|
237
|
+
{type}
|
|
238
|
+
</span>
|
|
239
|
+
{scopes && scopes.length > 0 && (
|
|
240
|
+
<span>
|
|
241
|
+
<strong>scopes: </strong>
|
|
242
|
+
<code>
|
|
243
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
244
|
+
</code>
|
|
245
|
+
</span>
|
|
246
|
+
)}
|
|
247
|
+
{Object.keys(rest).map((k, i) => {
|
|
248
|
+
return (
|
|
249
|
+
<span key={k}>
|
|
250
|
+
<strong>{k}: </strong>
|
|
251
|
+
{rest[k]}
|
|
252
|
+
</span>
|
|
253
|
+
);
|
|
254
|
+
})}
|
|
64
255
|
</pre>
|
|
65
256
|
</React.Fragment>
|
|
66
257
|
);
|
|
@@ -30,6 +30,10 @@ import styles from "./styles.module.css";
|
|
|
30
30
|
function ParamsItem({
|
|
31
31
|
param: { description, example, examples, name, required, schema },
|
|
32
32
|
}) {
|
|
33
|
+
if (!schema || !schema?.type) {
|
|
34
|
+
schema = { type: "any" };
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
const renderSchemaName = guard(schema, (schema) => (
|
|
34
38
|
<span className={styles.schemaName}> {getSchemaName(schema)}</span>
|
|
35
39
|
));
|
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-
|
|
4
|
+
"version": "0.0.0-570",
|
|
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-
|
|
54
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-570",
|
|
55
55
|
"file-saver": "^2.0.5",
|
|
56
56
|
"immer": "^9.0.7",
|
|
57
57
|
"lodash": "^4.17.20",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=14"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "4d31250d34849be84d2b57115c8ee8de0e98d509"
|
|
78
78
|
}
|
|
@@ -17,6 +17,10 @@ function SecuritySchemes(props: any) {
|
|
|
17
17
|
|
|
18
18
|
if (selected === undefined) return null;
|
|
19
19
|
|
|
20
|
+
if (options[selected]?.[0]?.type === undefined) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
const selectedAuth = options[selected];
|
|
21
25
|
return (
|
|
22
26
|
<details className={`details__demo-panel`} open={false}>
|
|
@@ -24,11 +28,90 @@ function SecuritySchemes(props: any) {
|
|
|
24
28
|
<h4>Authorization</h4>
|
|
25
29
|
</summary>
|
|
26
30
|
{selectedAuth.map((auth: any) => {
|
|
31
|
+
const isHttp = auth.type === "http";
|
|
27
32
|
const isApiKey = auth.type === "apiKey";
|
|
28
|
-
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
29
33
|
const isOauth2 = auth.type === "oauth2";
|
|
34
|
+
const isOpenId = auth.type === "openIdConnect";
|
|
30
35
|
|
|
31
|
-
if (
|
|
36
|
+
if (isHttp) {
|
|
37
|
+
if (auth.scheme === "bearer") {
|
|
38
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
39
|
+
return (
|
|
40
|
+
<React.Fragment key={auth.key}>
|
|
41
|
+
<pre
|
|
42
|
+
style={{
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
background: "var(--openapi-card-background-color)",
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<span>
|
|
49
|
+
<strong>name:</strong>{" "}
|
|
50
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
51
|
+
</span>
|
|
52
|
+
<span>
|
|
53
|
+
<strong>type: </strong>
|
|
54
|
+
{type}
|
|
55
|
+
</span>
|
|
56
|
+
{scopes && scopes.length > 0 && (
|
|
57
|
+
<span>
|
|
58
|
+
<strong>scopes: </strong>
|
|
59
|
+
<code>
|
|
60
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
61
|
+
</code>
|
|
62
|
+
</span>
|
|
63
|
+
)}
|
|
64
|
+
{Object.keys(rest).map((k, i) => {
|
|
65
|
+
return (
|
|
66
|
+
<span key={k}>
|
|
67
|
+
<strong>{k}: </strong>
|
|
68
|
+
{rest[k]}
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
72
|
+
</pre>
|
|
73
|
+
</React.Fragment>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (auth.scheme === "basic") {
|
|
77
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
78
|
+
return (
|
|
79
|
+
<React.Fragment key={auth.key}>
|
|
80
|
+
<pre
|
|
81
|
+
style={{
|
|
82
|
+
display: "flex",
|
|
83
|
+
flexDirection: "column",
|
|
84
|
+
background: "var(--openapi-card-background-color)",
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<span>
|
|
88
|
+
<strong>name:</strong>{" "}
|
|
89
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
90
|
+
</span>
|
|
91
|
+
<span>
|
|
92
|
+
<strong>type: </strong>
|
|
93
|
+
{type}
|
|
94
|
+
</span>
|
|
95
|
+
{scopes && scopes.length > 0 && (
|
|
96
|
+
<span>
|
|
97
|
+
<strong>scopes: </strong>
|
|
98
|
+
<code>
|
|
99
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
100
|
+
</code>
|
|
101
|
+
</span>
|
|
102
|
+
)}
|
|
103
|
+
{Object.keys(rest).map((k, i) => {
|
|
104
|
+
return (
|
|
105
|
+
<span key={k}>
|
|
106
|
+
<strong>{k}: </strong>
|
|
107
|
+
{rest[k]}
|
|
108
|
+
</span>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
111
|
+
</pre>
|
|
112
|
+
</React.Fragment>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
32
115
|
return (
|
|
33
116
|
<React.Fragment key={auth.key}>
|
|
34
117
|
<pre
|
|
@@ -38,17 +121,65 @@ function SecuritySchemes(props: any) {
|
|
|
38
121
|
background: "var(--openapi-card-background-color)",
|
|
39
122
|
}}
|
|
40
123
|
>
|
|
41
|
-
<span>type: {auth.type}</span>
|
|
42
124
|
<span>
|
|
43
|
-
|
|
125
|
+
<strong>name:</strong>{" "}
|
|
126
|
+
<Link to={infoAuthPath}>{auth.name ?? auth.key}</Link>
|
|
127
|
+
</span>
|
|
128
|
+
<span>
|
|
129
|
+
<strong>type: </strong>
|
|
130
|
+
{auth.type}
|
|
131
|
+
</span>
|
|
132
|
+
<span>
|
|
133
|
+
<strong>in: </strong>
|
|
134
|
+
{auth.in}
|
|
44
135
|
</span>
|
|
45
|
-
|
|
136
|
+
</pre>
|
|
137
|
+
</React.Fragment>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (isApiKey) {
|
|
142
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
143
|
+
return (
|
|
144
|
+
<React.Fragment key={auth.key}>
|
|
145
|
+
<pre
|
|
146
|
+
style={{
|
|
147
|
+
display: "flex",
|
|
148
|
+
flexDirection: "column",
|
|
149
|
+
background: "var(--openapi-card-background-color)",
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<span>
|
|
153
|
+
<strong>name:</strong>{" "}
|
|
154
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
155
|
+
</span>
|
|
156
|
+
<span>
|
|
157
|
+
<strong>type: </strong>
|
|
158
|
+
{type}
|
|
159
|
+
</span>
|
|
160
|
+
{scopes && scopes.length > 0 && (
|
|
161
|
+
<span>
|
|
162
|
+
<strong>scopes: </strong>
|
|
163
|
+
<code>
|
|
164
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
165
|
+
</code>
|
|
166
|
+
</span>
|
|
167
|
+
)}
|
|
168
|
+
{Object.keys(rest).map((k, i) => {
|
|
169
|
+
return (
|
|
170
|
+
<span key={k}>
|
|
171
|
+
<strong>{k}: </strong>
|
|
172
|
+
{rest[k]}
|
|
173
|
+
</span>
|
|
174
|
+
);
|
|
175
|
+
})}
|
|
46
176
|
</pre>
|
|
47
177
|
</React.Fragment>
|
|
48
178
|
);
|
|
49
179
|
}
|
|
50
180
|
|
|
51
181
|
if (isOauth2) {
|
|
182
|
+
const { name, key, type, scopes, flows, ...rest } = auth;
|
|
52
183
|
return (
|
|
53
184
|
<React.Fragment key={selected}>
|
|
54
185
|
<pre
|
|
@@ -59,14 +190,77 @@ function SecuritySchemes(props: any) {
|
|
|
59
190
|
}}
|
|
60
191
|
>
|
|
61
192
|
<span>
|
|
62
|
-
|
|
193
|
+
<strong>name:</strong>{" "}
|
|
194
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
195
|
+
</span>
|
|
196
|
+
<span>
|
|
197
|
+
<strong>type: </strong>
|
|
198
|
+
{type}
|
|
63
199
|
</span>
|
|
64
|
-
{
|
|
65
|
-
|
|
200
|
+
{scopes && scopes.length > 0 && (
|
|
201
|
+
<span>
|
|
202
|
+
<strong>scopes: </strong>
|
|
203
|
+
<code>
|
|
204
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
205
|
+
</code>
|
|
206
|
+
</span>
|
|
207
|
+
)}
|
|
208
|
+
{Object.keys(rest).map((k, i) => {
|
|
209
|
+
return (
|
|
210
|
+
<span key={k}>
|
|
211
|
+
<strong>{k}: </strong>
|
|
212
|
+
{rest[k]}
|
|
213
|
+
</span>
|
|
214
|
+
);
|
|
66
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
|
+
|
|
229
|
+
if (isOpenId) {
|
|
230
|
+
const { name, key, scopes, type, ...rest } = auth;
|
|
231
|
+
return (
|
|
232
|
+
<React.Fragment key={auth.key}>
|
|
233
|
+
<pre
|
|
234
|
+
style={{
|
|
235
|
+
display: "flex",
|
|
236
|
+
flexDirection: "column",
|
|
237
|
+
background: "var(--openapi-card-background-color)",
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
67
240
|
<span>
|
|
68
|
-
|
|
241
|
+
<strong>name:</strong>{" "}
|
|
242
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
69
243
|
</span>
|
|
244
|
+
<span>
|
|
245
|
+
<strong>type: </strong>
|
|
246
|
+
{type}
|
|
247
|
+
</span>
|
|
248
|
+
{scopes && scopes.length > 0 && (
|
|
249
|
+
<span>
|
|
250
|
+
<strong>scopes: </strong>
|
|
251
|
+
<code>
|
|
252
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
253
|
+
</code>
|
|
254
|
+
</span>
|
|
255
|
+
)}
|
|
256
|
+
{Object.keys(rest).map((k, i) => {
|
|
257
|
+
return (
|
|
258
|
+
<span key={k}>
|
|
259
|
+
<strong>{k}: </strong>
|
|
260
|
+
{rest[k]}
|
|
261
|
+
</span>
|
|
262
|
+
);
|
|
263
|
+
})}
|
|
70
264
|
</pre>
|
|
71
265
|
</React.Fragment>
|
|
72
266
|
);
|
|
@@ -30,6 +30,10 @@ import styles from "./styles.module.css";
|
|
|
30
30
|
function ParamsItem({
|
|
31
31
|
param: { description, example, examples, name, required, schema },
|
|
32
32
|
}) {
|
|
33
|
+
if (!schema || !schema?.type) {
|
|
34
|
+
schema = { type: "any" };
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
const renderSchemaName = guard(schema, (schema) => (
|
|
34
38
|
<span className={styles.schemaName}> {getSchemaName(schema)}</span>
|
|
35
39
|
));
|