docusaurus-theme-openapi-docs 1.1.12 → 1.2.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/theme/ApiDemoPanel/Authorization/auth-types.js +4 -0
- package/lib/theme/ApiDemoPanel/Authorization/index.js +125 -0
- package/lib/theme/ApiDemoPanel/Authorization/slice.js +1 -1
- package/lib/theme/ApiDemoPanel/Body/index.js +7 -6
- package/lib/theme/ApiDemoPanel/Execute/index.js +168 -0
- package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +204 -0
- package/lib/theme/ApiDemoPanel/FormItem/index.js +7 -0
- package/lib/theme/ApiDemoPanel/FormItem/styles.module.css +5 -0
- package/lib/theme/ApiDemoPanel/ParamOptions/index.js +1 -1
- package/lib/theme/ApiDemoPanel/Request/index.js +78 -0
- package/lib/theme/ApiDemoPanel/Request/styles.module.css +17 -0
- package/lib/theme/ApiDemoPanel/Response/index.js +16 -12
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +24 -19
- package/lib/theme/ApiDemoPanel/Server/index.js +1 -0
- package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +25 -3
- package/lib/theme/ApiDemoPanel/index.js +5 -13
- package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +1 -1
- package/lib/theme/ApiDemoPanel/react-modal.d.ts +8 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +56 -0
- package/lib/theme/ApiTabs/styles.module.css +9 -5
- package/lib/theme/ParamsItem/index.js +5 -1
- package/lib/theme/SchemaTabs/styles.module.css +10 -6
- package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +4 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +149 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +1 -1
- package/lib-next/theme/ApiDemoPanel/Body/index.js +28 -6
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +170 -0
- package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +190 -0
- package/lib-next/theme/ApiDemoPanel/FormItem/index.js +9 -1
- package/lib-next/theme/ApiDemoPanel/FormItem/styles.module.css +5 -0
- package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/Request/index.js +60 -0
- package/lib-next/theme/ApiDemoPanel/Request/styles.module.css +17 -0
- package/lib-next/theme/ApiDemoPanel/Response/index.js +18 -13
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +22 -20
- package/lib-next/theme/ApiDemoPanel/Server/index.js +1 -0
- package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +25 -3
- package/lib-next/theme/ApiDemoPanel/index.js +4 -13
- package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +1 -1
- package/lib-next/theme/ApiDemoPanel/react-modal.d.ts +8 -0
- package/lib-next/theme/ApiItem/Layout/styles.module.css +56 -0
- package/lib-next/theme/ApiTabs/styles.module.css +9 -5
- package/lib-next/theme/ParamsItem/index.js +5 -1
- package/lib-next/theme/SchemaTabs/styles.module.css +10 -6
- package/package.json +5 -4
- package/src/theme/ApiDemoPanel/Authorization/auth-types.ts +4 -0
- package/src/theme/ApiDemoPanel/Authorization/index.tsx +154 -0
- package/src/theme/ApiDemoPanel/Authorization/slice.ts +1 -1
- package/src/theme/ApiDemoPanel/Body/index.tsx +28 -6
- package/src/theme/ApiDemoPanel/Execute/index.tsx +188 -0
- package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +197 -0
- package/src/theme/ApiDemoPanel/FormItem/index.tsx +11 -2
- package/src/theme/ApiDemoPanel/FormItem/styles.module.css +5 -0
- package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/Request/index.tsx +71 -0
- package/src/theme/ApiDemoPanel/Request/styles.module.css +17 -0
- package/src/theme/ApiDemoPanel/Response/index.tsx +19 -13
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +22 -17
- package/src/theme/ApiDemoPanel/Server/index.tsx +1 -0
- package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +22 -3
- package/src/theme/ApiDemoPanel/index.tsx +4 -13
- package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +1 -1
- package/src/theme/ApiDemoPanel/react-modal.d.ts +8 -0
- package/src/theme/ApiItem/Layout/styles.module.css +56 -0
- package/src/theme/ApiTabs/styles.module.css +9 -5
- package/src/theme/ParamsItem/index.js +5 -1
- package/src/theme/SchemaTabs/styles.module.css +10 -6
|
@@ -261,6 +261,25 @@ function buildPostmanRequest(
|
|
|
261
261
|
continue;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
if (a.type === "oauth2") {
|
|
265
|
+
let token;
|
|
266
|
+
if (auth.data[a.key]) {
|
|
267
|
+
token = auth.data[a.key].token;
|
|
268
|
+
}
|
|
269
|
+
if (token === undefined) {
|
|
270
|
+
otherHeaders.push({
|
|
271
|
+
key: "Authorization",
|
|
272
|
+
value: "Bearer <TOKEN>",
|
|
273
|
+
});
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
otherHeaders.push({
|
|
277
|
+
key: "Authorization",
|
|
278
|
+
value: `Bearer ${token}`,
|
|
279
|
+
});
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
|
|
264
283
|
// Basic Auth
|
|
265
284
|
if (a.type === "http" && a.scheme === "basic") {
|
|
266
285
|
const { username, password } = auth.data[a.key];
|
|
@@ -276,8 +295,8 @@ function buildPostmanRequest(
|
|
|
276
295
|
|
|
277
296
|
// API Key
|
|
278
297
|
if (a.type === "apiKey" && a.in === "header") {
|
|
279
|
-
const {
|
|
280
|
-
if (
|
|
298
|
+
const { apiKey } = auth.data[a.key];
|
|
299
|
+
if (apiKey === undefined) {
|
|
281
300
|
otherHeaders.push({
|
|
282
301
|
key: a.name,
|
|
283
302
|
value: "<API_KEY_VALUE>",
|
|
@@ -286,7 +305,7 @@ function buildPostmanRequest(
|
|
|
286
305
|
}
|
|
287
306
|
otherHeaders.push({
|
|
288
307
|
key: a.name,
|
|
289
|
-
value:
|
|
308
|
+
value: apiKey,
|
|
290
309
|
});
|
|
291
310
|
continue;
|
|
292
311
|
}
|
|
@@ -14,13 +14,11 @@ import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
|
14
14
|
import { Provider } from "react-redux";
|
|
15
15
|
|
|
16
16
|
import { ThemeConfig } from "../../types";
|
|
17
|
-
import Accept from "./Accept";
|
|
18
17
|
import { createAuth } from "./Authorization/slice";
|
|
19
|
-
import Body from "./Body";
|
|
20
18
|
import Curl from "./Curl";
|
|
21
19
|
import MethodEndpoint from "./MethodEndpoint";
|
|
22
|
-
import ParamOptions from "./ParamOptions";
|
|
23
20
|
import { createPersistanceMiddleware } from "./persistanceMiddleware";
|
|
21
|
+
import Request from "./Request";
|
|
24
22
|
import Response from "./Response";
|
|
25
23
|
import SecuritySchemes from "./SecuritySchemes";
|
|
26
24
|
import Server from "./Server";
|
|
@@ -95,21 +93,14 @@ function ApiDemoPanel({
|
|
|
95
93
|
<Provider store={store2}>
|
|
96
94
|
<div className={styles.apiDemoPanelContainer}>
|
|
97
95
|
<MethodEndpoint method={method} path={path} />
|
|
98
|
-
<SecuritySchemes infoPath={infoPath} />
|
|
99
|
-
<div className={styles.optionsPanel}>
|
|
100
|
-
<ParamOptions />
|
|
101
|
-
<Body
|
|
102
|
-
jsonRequestBodyExample={item.jsonRequestBodyExample}
|
|
103
|
-
requestBodyMetadata={item.requestBody}
|
|
104
|
-
/>
|
|
105
|
-
<Accept />
|
|
106
|
-
</div>
|
|
107
96
|
<Server />
|
|
97
|
+
<SecuritySchemes infoPath={infoPath} />
|
|
98
|
+
<Request item={item} />
|
|
99
|
+
<Response />
|
|
108
100
|
<Curl
|
|
109
101
|
postman={postman}
|
|
110
102
|
codeSamples={(item as any)["x-code-samples"] ?? []}
|
|
111
103
|
/>
|
|
112
|
-
<Response />
|
|
113
104
|
</div>
|
|
114
105
|
</Provider>
|
|
115
106
|
);
|
|
@@ -19,7 +19,7 @@ export function createPersistanceMiddleware(options: ThemeConfig["api"]) {
|
|
|
19
19
|
|
|
20
20
|
const state = storeAPI.getState();
|
|
21
21
|
|
|
22
|
-
const storage = createStorage(
|
|
22
|
+
const storage = createStorage("sessionStorage");
|
|
23
23
|
|
|
24
24
|
if (action.type === setAuthData.type) {
|
|
25
25
|
for (const [key, value] of Object.entries(state.auth.data)) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
declare module "react-modal";
|
|
@@ -71,6 +71,62 @@
|
|
|
71
71
|
border-top: unset !important;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
:global(.theme-api-markdown .details__demo-panel) {
|
|
75
|
+
margin-bottom: 1rem;
|
|
76
|
+
background: var(--openapi-card-background-color);
|
|
77
|
+
border-radius: var(--openapi-card-border-radius);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:global(.theme-api-markdown .details__demo-panel > summary) {
|
|
81
|
+
padding-left: 1rem;
|
|
82
|
+
padding-top: 1rem;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:global(.theme-api-markdown .details__demo-panel > div > div > pre) {
|
|
87
|
+
border-top-left-radius: 0;
|
|
88
|
+
border-top-right-radius: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:global(.theme-api-markdown .details__demo-panel > summary::marker) {
|
|
92
|
+
display: none;
|
|
93
|
+
content: "";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:global(.theme-api-markdown
|
|
97
|
+
.details__demo-panel
|
|
98
|
+
> summary::-webkit-details-marker) {
|
|
99
|
+
display: none;
|
|
100
|
+
content: "";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:global(.theme-api-markdown .details__demo-panel > pre) {
|
|
104
|
+
margin-bottom: 0;
|
|
105
|
+
padding-top: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:global(.theme-api-markdown .details__request-summary) {
|
|
109
|
+
display: flex;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
align-items: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:global(.theme-api-markdown .details__request-summary > button) {
|
|
115
|
+
margin-bottom: 1rem;
|
|
116
|
+
margin-right: 1rem;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:global(.theme-api-markdown .details__response-summary) {
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:global(.theme-api-markdown .details__response-summary > button) {
|
|
126
|
+
margin-bottom: 1rem;
|
|
127
|
+
margin-right: 1rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
74
130
|
:global(.theme-api-markdown code) {
|
|
75
131
|
max-width: 600px;
|
|
76
132
|
max-height: 500px;
|
|
@@ -12,14 +12,19 @@
|
|
|
12
12
|
height: 2.5rem;
|
|
13
13
|
margin-top: 0 !important;
|
|
14
14
|
margin-right: 0.5rem;
|
|
15
|
-
border: 1px solid var(--
|
|
15
|
+
border: 1px solid var(--ifm-color-primary);
|
|
16
16
|
border-radius: var(--ifm-global-radius);
|
|
17
|
+
color: var(--ifm-color-primary);
|
|
17
18
|
font-weight: var(--ifm-font-weight-normal);
|
|
18
|
-
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tabItem:not(.responseTabActive) {
|
|
22
|
+
opacity: 0.65;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
.tabItem:hover {
|
|
22
|
-
|
|
26
|
+
opacity: 1;
|
|
27
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
.tabItem:last-child {
|
|
@@ -74,8 +79,7 @@
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
.responseTabActive {
|
|
77
|
-
|
|
78
|
-
color: var(--ifm-color-primary);
|
|
82
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
.responseSchemaContainer {
|
|
@@ -53,7 +53,11 @@ function ParamsItem({
|
|
|
53
53
|
));
|
|
54
54
|
|
|
55
55
|
const renderDefaultValue = guard(
|
|
56
|
-
schema
|
|
56
|
+
schema && schema.items
|
|
57
|
+
? schema.items.default
|
|
58
|
+
: schema
|
|
59
|
+
? schema.default
|
|
60
|
+
: undefined,
|
|
57
61
|
(value) => (
|
|
58
62
|
<div>
|
|
59
63
|
<ReactMarkdown children={`**Default value:** \`${value}\``} />
|
|
@@ -12,14 +12,19 @@
|
|
|
12
12
|
height: 1.8rem;
|
|
13
13
|
margin-top: 0 !important;
|
|
14
14
|
margin-right: 0.5rem;
|
|
15
|
-
border: 1px solid var(--
|
|
15
|
+
border: 1px solid var(--ifm-color-primary);
|
|
16
16
|
border-radius: var(--ifm-global-radius);
|
|
17
|
-
color: var(--
|
|
17
|
+
color: var(--ifm-color-primary);
|
|
18
18
|
font-size: 12px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.tabItem:not(.schemaTabActive) {
|
|
22
|
+
opacity: 0.65;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.tabItem:hover {
|
|
22
|
-
|
|
26
|
+
opacity: 1;
|
|
27
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
.tabItem:last-child {
|
|
@@ -49,9 +54,8 @@
|
|
|
49
54
|
display: none;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
color: var(--ifm-color-primary);
|
|
57
|
+
.schemaTabActive {
|
|
58
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
.schemaTabLabel {
|