docusaurus-theme-openapi-docs 4.1.0 → 4.2.0
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/ApiExplorer/CodeSnippets/index.js +2 -1
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
- package/lib/theme/ApiItem/Layout/index.js +6 -2
- package/lib/theme/ApiItem/index.js +15 -4
- package/lib/theme/ApiTabs/_ApiTabs.scss +0 -1
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/ParamsDetails/index.d.ts +6 -0
- package/lib/theme/ParamsDetails/index.js +134 -0
- package/lib/theme/ParamsItem/index.d.ts +1 -0
- package/lib/theme/ParamsItem/index.js +10 -6
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +235 -0
- package/lib/theme/ResponseExamples/index.d.ts +48 -0
- package/lib/theme/ResponseExamples/index.js +290 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +206 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +879 -0
- package/lib/theme/SchemaItem/index.d.ts +8 -8
- package/lib/theme/SchemaItem/index.js +9 -5
- package/lib/theme/SkeletonLoader/index.d.ts +6 -0
- package/lib/theme/SkeletonLoader/index.js +20 -0
- package/lib/theme/StatusCodes/index.d.ts +9 -0
- package/lib/theme/StatusCodes/index.js +78 -0
- package/lib/theme/styles.scss +56 -9
- package/package.json +6 -5
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +2 -1
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
- package/src/theme/ApiItem/Layout/index.tsx +5 -2
- package/src/theme/ApiItem/index.tsx +14 -2
- package/src/theme/ApiTabs/_ApiTabs.scss +0 -1
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/ParamsDetails/index.tsx +88 -0
- package/src/theme/ParamsItem/index.tsx +10 -7
- package/src/theme/RequestSchema/index.tsx +164 -0
- package/src/theme/ResponseExamples/index.tsx +290 -0
- package/src/theme/ResponseSchema/index.tsx +151 -0
- package/src/theme/Schema/index.tsx +928 -0
- package/src/theme/SchemaItem/index.tsx +15 -13
- package/src/theme/SkeletonLoader/index.tsx +18 -0
- package/src/theme/StatusCodes/index.tsx +72 -0
- package/src/theme/styles.scss +56 -9
|
@@ -17,15 +17,15 @@ import { createDescription } from "../../markdown/createDescription";
|
|
|
17
17
|
import { guard } from "../../markdown/utils";
|
|
18
18
|
|
|
19
19
|
export interface Props {
|
|
20
|
-
children
|
|
21
|
-
collapsible
|
|
22
|
-
name
|
|
23
|
-
qualifierMessage
|
|
24
|
-
required
|
|
25
|
-
schemaName
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
name?: string;
|
|
23
|
+
qualifierMessage?: string | undefined;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
schemaName?: string;
|
|
26
26
|
// TODO should probably be typed
|
|
27
|
-
schema
|
|
28
|
-
discriminator
|
|
27
|
+
schema?: any;
|
|
28
|
+
discriminator?: boolean;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const transformEnumDescriptions = (
|
|
@@ -96,11 +96,13 @@ export default function SchemaItem(props: Props) {
|
|
|
96
96
|
getEnumDescriptionMarkdown(enumDescriptions),
|
|
97
97
|
(value) => {
|
|
98
98
|
return (
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
<div style={{ marginTop: ".5rem" }}>
|
|
100
|
+
<ReactMarkdown
|
|
101
|
+
remarkPlugins={[remarkGfm]}
|
|
102
|
+
rehypePlugins={[rehypeRaw]}
|
|
103
|
+
children={value}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
104
106
|
);
|
|
105
107
|
}
|
|
106
108
|
);
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SkeletonLoader: React.FC<Props> = (props) => {
|
|
15
|
+
return <div className={`openapi-skeleton ${props.size ?? "md"}`}></div>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default SkeletonLoader;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import ApiTabs from "@theme/ApiTabs";
|
|
11
|
+
import Details from "@theme/Details";
|
|
12
|
+
import { ResponseHeaders } from "@theme/ResponseExamples";
|
|
13
|
+
import ResponseSchema from "@theme/ResponseSchema";
|
|
14
|
+
import TabItem from "@theme/TabItem";
|
|
15
|
+
import { createDescription } from "docusaurus-plugin-openapi-docs/lib/markdown/createDescription";
|
|
16
|
+
import { ApiItem } from "docusaurus-plugin-openapi-docs/lib/types";
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
id?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
responses: ApiItem["responses"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const StatusCodes: React.FC<Props> = ({ label, id, responses }: any) => {
|
|
25
|
+
if (!responses) return null;
|
|
26
|
+
|
|
27
|
+
const codes = Object.keys(responses);
|
|
28
|
+
if (codes.length === 0) return null;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ApiTabs label={label} id={id}>
|
|
32
|
+
{codes.map((code) => {
|
|
33
|
+
const response = responses[code];
|
|
34
|
+
const responseHeaders = response.headers;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
<TabItem key={code} label={code} value={code}>
|
|
39
|
+
<div>
|
|
40
|
+
{response.description && (
|
|
41
|
+
<div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>
|
|
42
|
+
{createDescription(response.description)}
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
{responseHeaders && (
|
|
47
|
+
<Details
|
|
48
|
+
className="openapi-markdown__details"
|
|
49
|
+
data-collapsed={true}
|
|
50
|
+
open={false}
|
|
51
|
+
style={{ textAlign: "left", marginBottom: "1rem" }}
|
|
52
|
+
summary={
|
|
53
|
+
<summary>
|
|
54
|
+
<strong>Response Headers</strong>
|
|
55
|
+
</summary>
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
<ResponseHeaders responseHeaders={responseHeaders} />
|
|
59
|
+
</Details>
|
|
60
|
+
)}
|
|
61
|
+
<ResponseSchema
|
|
62
|
+
title="Schema"
|
|
63
|
+
body={{ content: response.content }}
|
|
64
|
+
/>
|
|
65
|
+
</TabItem>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</ApiTabs>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default StatusCodes;
|
package/src/theme/styles.scss
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
--openapi-explorer-padding-input: 0.5rem;
|
|
82
82
|
--openapi-explorer-border-color: var(--ifm-toc-border-color);
|
|
83
83
|
--openapi-explorer-caret-bg: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>');
|
|
84
|
+
--openapi-skeleton-background: var(--ifm-color-emphasis-100);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
[data-theme="dark"] {
|
|
@@ -92,16 +93,16 @@
|
|
|
92
93
|
height: 100%;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
@media (min-width: 997px) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
// @media (min-width: 997px) {
|
|
97
|
+
// .docItemCol {
|
|
98
|
+
// max-width: 75% !important;
|
|
99
|
+
// }
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
101
|
+
// /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
|
|
102
|
+
// .tocMobile {
|
|
103
|
+
// display: none;
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
105
106
|
|
|
106
107
|
/* Begin OpenAPI theme styles */
|
|
107
108
|
// [data-theme="dark"] {
|
|
@@ -160,6 +161,52 @@
|
|
|
160
161
|
border-right: thin solid var(--ifm-toc-border-color);
|
|
161
162
|
}
|
|
162
163
|
|
|
164
|
+
@media (max-width: 997px) {
|
|
165
|
+
.schema {
|
|
166
|
+
margin-bottom: 1rem;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
163
170
|
.openapi-tabs__heading {
|
|
164
171
|
margin-bottom: 1rem;
|
|
165
172
|
}
|
|
173
|
+
|
|
174
|
+
/* Loading Skeleton */
|
|
175
|
+
@keyframes pulsing {
|
|
176
|
+
0% {
|
|
177
|
+
opacity: 1;
|
|
178
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
179
|
+
}
|
|
180
|
+
50% {
|
|
181
|
+
opacity: 0.6;
|
|
182
|
+
background-color: var(--ifm-toc-border-color);
|
|
183
|
+
}
|
|
184
|
+
100% {
|
|
185
|
+
opacity: 1;
|
|
186
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.openapi-skeleton {
|
|
191
|
+
animation: pulsing 2s infinite ease-in-out;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Loading Skeleton */
|
|
195
|
+
.openapi-skeleton {
|
|
196
|
+
border-radius: var(--ifm-pre-border-radius);
|
|
197
|
+
background-color: var(--openapi-skeleton-background);
|
|
198
|
+
max-width: 100%;
|
|
199
|
+
margin: 1rem auto;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.openapi-skeleton.sm {
|
|
203
|
+
height: 100px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.openapi-skeleton.md {
|
|
207
|
+
height: 350px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.openapi-skeleton.lg {
|
|
211
|
+
height: 96.5%;
|
|
212
|
+
}
|