docusaurus-theme-openapi-docs 4.1.0 → 4.3.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.
Files changed (56) hide show
  1. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +0 -12
  2. package/lib/theme/ApiExplorer/Authorization/index.js +3 -0
  3. package/lib/theme/ApiExplorer/Body/index.js +11 -2
  4. package/lib/theme/ApiExplorer/CodeSnippets/index.js +2 -1
  5. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
  6. package/lib/theme/ApiItem/Layout/index.js +6 -2
  7. package/lib/theme/ApiItem/index.js +15 -4
  8. package/lib/theme/ApiTabs/_ApiTabs.scss +0 -1
  9. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  10. package/lib/theme/ArrayBrackets/index.js +50 -0
  11. package/lib/theme/Markdown/Details/_Details.scss +5 -2
  12. package/lib/theme/Markdown/index.js +160 -18
  13. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  14. package/lib/theme/ParamsDetails/index.js +134 -0
  15. package/lib/theme/ParamsItem/index.d.ts +1 -0
  16. package/lib/theme/ParamsItem/index.js +11 -48
  17. package/lib/theme/RequestSchema/index.d.ts +15 -0
  18. package/lib/theme/RequestSchema/index.js +243 -0
  19. package/lib/theme/ResponseExamples/index.d.ts +18 -0
  20. package/lib/theme/ResponseExamples/index.js +194 -0
  21. package/lib/theme/ResponseHeaders/index.d.ts +13 -0
  22. package/lib/theme/ResponseHeaders/index.js +39 -0
  23. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  24. package/lib/theme/ResponseSchema/index.js +208 -0
  25. package/lib/theme/Schema/index.d.ts +8 -0
  26. package/lib/theme/Schema/index.js +887 -0
  27. package/lib/theme/SchemaItem/index.d.ts +8 -8
  28. package/lib/theme/SchemaItem/index.js +11 -41
  29. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  30. package/lib/theme/SkeletonLoader/index.js +20 -0
  31. package/lib/theme/StatusCodes/index.d.ts +9 -0
  32. package/lib/theme/StatusCodes/index.js +81 -0
  33. package/lib/theme/styles.scss +56 -9
  34. package/package.json +13 -8
  35. package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +0 -12
  36. package/src/theme/ApiExplorer/Authorization/index.tsx +3 -0
  37. package/src/theme/ApiExplorer/Body/index.tsx +3 -2
  38. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +2 -1
  39. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
  40. package/src/theme/ApiItem/Layout/index.tsx +5 -2
  41. package/src/theme/ApiItem/index.tsx +14 -2
  42. package/src/theme/ApiTabs/_ApiTabs.scss +0 -1
  43. package/src/theme/ArrayBrackets/index.tsx +37 -0
  44. package/src/theme/Markdown/Details/_Details.scss +5 -2
  45. package/src/theme/Markdown/index.js +160 -18
  46. package/src/theme/ParamsDetails/index.tsx +88 -0
  47. package/src/theme/ParamsItem/index.tsx +9 -36
  48. package/src/theme/RequestSchema/index.tsx +164 -0
  49. package/src/theme/ResponseExamples/index.tsx +192 -0
  50. package/src/theme/ResponseHeaders/index.tsx +49 -0
  51. package/src/theme/ResponseSchema/index.tsx +151 -0
  52. package/src/theme/Schema/index.tsx +935 -0
  53. package/src/theme/SchemaItem/index.tsx +21 -43
  54. package/src/theme/SkeletonLoader/index.tsx +18 -0
  55. package/src/theme/StatusCodes/index.tsx +72 -0
  56. package/src/theme/styles.scss +56 -9
@@ -1,12 +1,12 @@
1
1
  import React, { ReactNode } from "react";
2
2
  export interface Props {
3
- children: ReactNode;
4
- collapsible: boolean;
5
- name: string;
6
- qualifierMessage: string | undefined;
7
- required: boolean;
8
- schemaName: string;
9
- schema: any;
10
- discriminator: boolean;
3
+ children?: ReactNode;
4
+ collapsible?: boolean;
5
+ name?: string;
6
+ qualifierMessage?: string | undefined;
7
+ required?: boolean;
8
+ schemaName?: string;
9
+ schema?: any;
10
+ discriminator?: boolean;
11
11
  }
12
12
  export default function SchemaItem(props: Props): React.JSX.Element;
@@ -12,12 +12,8 @@ var __importDefault =
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  const react_1 = __importDefault(require("react"));
15
- const CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
15
+ const Markdown_1 = __importDefault(require("@theme/Markdown"));
16
16
  const clsx_1 = __importDefault(require("clsx"));
17
- const react_markdown_1 = __importDefault(require("react-markdown"));
18
- const rehype_raw_1 = __importDefault(require("rehype-raw"));
19
- const remark_gfm_1 = __importDefault(require("remark-gfm"));
20
- const createDescription_1 = require("../../markdown/createDescription");
21
17
  const utils_1 = require("../../markdown/utils");
22
18
  const transformEnumDescriptions = (enumDescriptions) => {
23
19
  if (enumDescriptions) {
@@ -88,54 +84,29 @@ function SchemaItem(props) {
88
84
  const renderEnumDescriptions = (0, utils_1.guard)(
89
85
  getEnumDescriptionMarkdown(enumDescriptions),
90
86
  (value) => {
91
- return react_1.default.createElement(react_markdown_1.default, {
92
- remarkPlugins: [remark_gfm_1.default],
93
- rehypePlugins: [rehype_raw_1.default],
94
- children: value,
95
- });
87
+ return react_1.default.createElement(
88
+ "div",
89
+ { style: { marginTop: ".5rem" } },
90
+ react_1.default.createElement(Markdown_1.default, null, value)
91
+ );
96
92
  }
97
93
  );
98
94
  const renderSchemaDescription = (0, utils_1.guard)(
99
95
  schemaDescription,
100
96
  (description) =>
101
97
  react_1.default.createElement(
102
- "div",
98
+ react_1.default.Fragment,
103
99
  null,
104
- react_1.default.createElement(react_markdown_1.default, {
105
- children: (0, createDescription_1.createDescription)(description),
106
- components: {
107
- pre: "div",
108
- code({ node, inline, className, children, ...props }) {
109
- const match = /language-(\w+)/.exec(className || "");
110
- if (inline)
111
- return react_1.default.createElement("code", null, children);
112
- return !inline && match
113
- ? react_1.default.createElement(
114
- CodeBlock_1.default,
115
- { className: className },
116
- children
117
- )
118
- : react_1.default.createElement(
119
- CodeBlock_1.default,
120
- null,
121
- children
122
- );
123
- },
124
- },
125
- rehypePlugins: [rehype_raw_1.default],
126
- })
100
+ react_1.default.createElement(Markdown_1.default, null, description)
127
101
  )
128
102
  );
129
103
  const renderQualifierMessage = (0, utils_1.guard)(
130
104
  qualifierMessage,
131
105
  (message) =>
132
106
  react_1.default.createElement(
133
- "div",
107
+ react_1.default.Fragment,
134
108
  null,
135
- react_1.default.createElement(react_markdown_1.default, {
136
- children: (0, createDescription_1.createDescription)(message),
137
- rehypePlugins: [rehype_raw_1.default],
138
- })
109
+ react_1.default.createElement(Markdown_1.default, null, message)
139
110
  )
140
111
  );
141
112
  function renderDefaultValue() {
@@ -214,8 +185,7 @@ function SchemaItem(props) {
214
185
  react_1.default.createElement(
215
186
  "span",
216
187
  { className: "openapi-schema__name" },
217
- " ",
218
- schemaName
188
+ Array.isArray(schemaName) ? schemaName.join(" | ") : schemaName
219
189
  ),
220
190
  (nullable || required || deprecated) &&
221
191
  react_1.default.createElement("span", {
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface Props {
3
+ size?: "sm" | "md" | "lg";
4
+ }
5
+ declare const SkeletonLoader: React.FC<Props>;
6
+ export default SkeletonLoader;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ var __importDefault =
9
+ (this && this.__importDefault) ||
10
+ function (mod) {
11
+ return mod && mod.__esModule ? mod : { default: mod };
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ const react_1 = __importDefault(require("react"));
15
+ const SkeletonLoader = (props) => {
16
+ return react_1.default.createElement("div", {
17
+ className: `openapi-skeleton ${props.size ?? "md"}`,
18
+ });
19
+ };
20
+ exports.default = SkeletonLoader;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { ApiItem } from "docusaurus-plugin-openapi-docs/lib/types";
3
+ interface Props {
4
+ id?: string;
5
+ label?: string;
6
+ responses: ApiItem["responses"];
7
+ }
8
+ declare const StatusCodes: React.FC<Props>;
9
+ export default StatusCodes;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ var __importDefault =
9
+ (this && this.__importDefault) ||
10
+ function (mod) {
11
+ return mod && mod.__esModule ? mod : { default: mod };
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ const react_1 = __importDefault(require("react"));
15
+ const ApiTabs_1 = __importDefault(require("@theme/ApiTabs"));
16
+ const Details_1 = __importDefault(require("@theme/Details"));
17
+ const Markdown_1 = __importDefault(require("@theme/Markdown"));
18
+ const ResponseHeaders_1 = __importDefault(require("@theme/ResponseHeaders"));
19
+ const ResponseSchema_1 = __importDefault(require("@theme/ResponseSchema"));
20
+ const TabItem_1 = __importDefault(require("@theme/TabItem"));
21
+ const StatusCodes = ({ label, id, responses }) => {
22
+ if (!responses) return null;
23
+ const codes = Object.keys(responses);
24
+ if (codes.length === 0) return null;
25
+ return react_1.default.createElement(
26
+ ApiTabs_1.default,
27
+ { label: label, id: id },
28
+ codes.map((code) => {
29
+ const response = responses[code];
30
+ const responseHeaders = response.headers;
31
+ return (
32
+ // @ts-ignore
33
+ react_1.default.createElement(
34
+ TabItem_1.default,
35
+ { key: code, label: code, value: code },
36
+ react_1.default.createElement(
37
+ "div",
38
+ null,
39
+ response.description &&
40
+ react_1.default.createElement(
41
+ "div",
42
+ { style: { marginTop: ".5rem", marginBottom: ".5rem" } },
43
+ react_1.default.createElement(
44
+ Markdown_1.default,
45
+ null,
46
+ response.description
47
+ )
48
+ )
49
+ ),
50
+ responseHeaders &&
51
+ react_1.default.createElement(
52
+ Details_1.default,
53
+ {
54
+ className: "openapi-markdown__details",
55
+ "data-collapsed": true,
56
+ open: false,
57
+ style: { textAlign: "left", marginBottom: "1rem" },
58
+ summary: react_1.default.createElement(
59
+ "summary",
60
+ null,
61
+ react_1.default.createElement(
62
+ "strong",
63
+ null,
64
+ "Response Headers"
65
+ )
66
+ ),
67
+ },
68
+ react_1.default.createElement(ResponseHeaders_1.default, {
69
+ responseHeaders: responseHeaders,
70
+ })
71
+ ),
72
+ react_1.default.createElement(ResponseSchema_1.default, {
73
+ title: "Schema",
74
+ body: { content: response.content },
75
+ })
76
+ )
77
+ );
78
+ })
79
+ );
80
+ };
81
+ exports.default = StatusCodes;
@@ -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
- .docItemCol {
97
- max-width: 75% !important;
98
- }
96
+ // @media (min-width: 997px) {
97
+ // .docItemCol {
98
+ // max-width: 75% !important;
99
+ // }
99
100
 
100
- /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
101
- .tocMobile {
102
- display: none;
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
+ }
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": "4.1.0",
4
+ "version": "4.3.0",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -28,25 +28,26 @@
28
28
  "watch": "concurrently --names \"lib,lib-next,tsc\" --kill-others \"yarn babel:lib --watch\" \"yarn babel:lib-next --watch\" \"yarn tsc --watch\""
29
29
  },
30
30
  "devDependencies": {
31
+ "@docusaurus/theme-common": "^3.5.0",
31
32
  "@docusaurus/types": "^3.5.0",
32
33
  "@types/crypto-js": "^4.1.0",
33
34
  "@types/file-saver": "^2.0.5",
34
35
  "@types/lodash": "^4.14.176",
35
36
  "concurrently": "^5.2.0",
37
+ "docusaurus-plugin-openapi-docs": "^4.3.0",
38
+ "docusaurus-plugin-sass": "^0.2.3",
36
39
  "eslint-plugin-prettier": "^5.0.1"
37
40
  },
38
41
  "dependencies": {
39
- "@docusaurus/theme-common": "^3.5.0",
40
42
  "@hookform/error-message": "^2.0.1",
41
43
  "@reduxjs/toolkit": "^1.7.1",
44
+ "allof-merge": "^0.6.6",
42
45
  "clsx": "^1.1.1",
43
46
  "copy-text-to-clipboard": "^3.1.0",
44
47
  "crypto-js": "^4.1.1",
45
- "docusaurus-plugin-openapi-docs": "^4.1.0",
46
- "docusaurus-plugin-sass": "^0.2.3",
47
48
  "file-saver": "^2.0.5",
48
49
  "lodash": "^4.17.20",
49
- "node-polyfill-webpack-plugin": "^2.0.1",
50
+ "node-polyfill-webpack-plugin": "^3.0.0",
50
51
  "postman-code-generators": "^1.10.1",
51
52
  "postman-collection": "^4.4.0",
52
53
  "prism-react-renderer": "^2.3.0",
@@ -58,17 +59,21 @@
58
59
  "react-redux": "^7.2.0",
59
60
  "rehype-raw": "^6.1.1",
60
61
  "remark-gfm": "3.0.1",
61
- "sass": "^1.58.1",
62
- "sass-loader": "^13.3.2",
62
+ "sass": "^1.80.4",
63
+ "sass-loader": "^16.0.2",
64
+ "unist-util-visit": "^5.0.0",
63
65
  "webpack": "^5.61.0",
64
66
  "xml-formatter": "^2.6.1"
65
67
  },
66
68
  "peerDependencies": {
69
+ "@docusaurus/theme-common": "^3.5.0",
70
+ "docusaurus-plugin-openapi-docs": "^4.0.0",
71
+ "docusaurus-plugin-sass": "^0.2.3",
67
72
  "react": "^16.8.4 || ^17.0.0 || ^18.0.0",
68
73
  "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0"
69
74
  },
70
75
  "engines": {
71
76
  "node": ">=14"
72
77
  },
73
- "gitHead": "4e771d309f6defe395449b26cc3c65814d72cbcc"
78
+ "gitHead": "e16e2f912a3da02444d1755b6d350deadd62185f"
74
79
  }
@@ -8,13 +8,6 @@ the background in custom CSS file due bug https://github.com/facebook/docusaurus
8
8
  --docusaurus-highlighted-code-line-bg: rgb(100 100 100);
9
9
  }
10
10
 
11
- .theme-code-block-highlighted-line {
12
- background-color: var(--docusaurus-highlighted-code-line-bg);
13
- display: block;
14
- margin: 0 calc(-1 * var(--ifm-pre-padding));
15
- padding: 0 var(--ifm-pre-padding);
16
- }
17
-
18
11
  .openapi-explorer__code-block-code-line {
19
12
  display: table-row;
20
13
  counter-increment: line-count;
@@ -36,11 +29,6 @@ the background in custom CSS file due bug https://github.com/facebook/docusaurus
36
29
  opacity: 0.4;
37
30
  }
38
31
 
39
- :global(.theme-code-block-highlighted-line)
40
- .openapi-explorer__code-block-code-line-number::before {
41
- opacity: 0.8;
42
- }
43
-
44
32
  .openapi-explorer__code-block-code-line-number {
45
33
  padding-right: var(--ifm-pre-padding);
46
34
  }
@@ -48,6 +48,7 @@ function Authorization() {
48
48
  <FormItem label="Bearer Token" key={a.key + "-bearer"}>
49
49
  <FormTextInput
50
50
  placeholder="Bearer Token"
51
+ password
51
52
  value={data[a.key].token ?? ""}
52
53
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
53
54
  const value = e.target.value;
@@ -69,6 +70,7 @@ function Authorization() {
69
70
  <FormItem label="Bearer Token" key={a.key + "-oauth2"}>
70
71
  <FormTextInput
71
72
  placeholder="Bearer Token"
73
+ password
72
74
  value={data[a.key].token ?? ""}
73
75
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
74
76
  const value = e.target.value;
@@ -130,6 +132,7 @@ function Authorization() {
130
132
  <FormItem label={`${a.key}`} key={a.key + "-apikey"}>
131
133
  <FormTextInput
132
134
  placeholder={`${a.key}`}
135
+ password
133
136
  value={data[a.key].apiKey ?? ""}
134
137
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
135
138
  const value = e.target.value;
@@ -14,6 +14,7 @@ import FormSelect from "@theme/ApiExplorer/FormSelect";
14
14
  import FormTextInput from "@theme/ApiExplorer/FormTextInput";
15
15
  import LiveApp from "@theme/ApiExplorer/LiveEditor";
16
16
  import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
17
+ import Markdown from "@theme/Markdown";
17
18
  import SchemaTabs from "@theme/SchemaTabs";
18
19
  import TabItem from "@theme/TabItem";
19
20
  import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
@@ -303,7 +304,7 @@ function Body({
303
304
  </TabItem>
304
305
  {/* @ts-ignore */}
305
306
  <TabItem label="Example" value="example">
306
- {example.summary && <div>{example.summary}</div>}
307
+ {example.summary && <Markdown>{example.summary}</Markdown>}
307
308
  {exampleBody && (
308
309
  <LiveApp
309
310
  action={dispatch}
@@ -341,7 +342,7 @@ function Body({
341
342
  value={example.label}
342
343
  key={example.label}
343
344
  >
344
- {example.summary && <div>{example.summary}</div>}
345
+ {example.summary && <Markdown>{example.summary}</Markdown>}
345
346
  {example.body && (
346
347
  <LiveApp action={dispatch} language={language}>
347
348
  {example.body}
@@ -180,7 +180,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
180
180
  ]);
181
181
  // no dependencies was intentionlly set for this particular hook. it's safe as long as if conditions are set
182
182
  useEffect(function onSelectedVariantUpdate() {
183
- if (selectedVariant && selectedVariant !== language.variant) {
183
+ if (selectedVariant && selectedVariant !== language?.variant) {
184
184
  const postmanRequest = buildPostmanRequest(postman, {
185
185
  queryParams,
186
186
  pathParams,
@@ -211,6 +211,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
211
211
  // eslint-disable-next-line react-hooks/exhaustive-deps
212
212
  useEffect(function onSelectedSampleUpdate() {
213
213
  if (
214
+ language &&
214
215
  language.samples &&
215
216
  language.samplesSources &&
216
217
  selectedSample &&
@@ -436,6 +436,56 @@ body[class="ReactModal__Body--open"] {
436
436
  }
437
437
  }
438
438
 
439
+ .openapi-tabs__code-item--http {
440
+ color: var(--ifm-color-gray-500);
441
+ display: flex;
442
+ align-items: center;
443
+ justify-content: center;
444
+ position: relative;
445
+
446
+ &::after {
447
+ content: "";
448
+ display: inline-block;
449
+ width: 32px; /* Explicitly setting width to 32 pixels */
450
+ height: 32px; /* Explicitly setting height to 32 pixels */
451
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIyTDggMTZMMTIgMTBNMjAgMjJMMjQgMTZMIDIwIDEwIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=");
452
+ background-size: contain;
453
+ background-repeat: no-repeat;
454
+ background-position: center; /* Center the SVG */
455
+ margin-top: 0.5rem;
456
+ }
457
+
458
+ &.active {
459
+ box-shadow: 0 0 0 3px var(--opeanpi-code-tab-shadow-color-http);
460
+ border-color: var(--openapi-code-tab-border-color-http);
461
+ }
462
+ }
463
+
464
+ .openapi-tabs__code-item--shell {
465
+ color: var(--ifm-color-gray-500);
466
+ display: flex;
467
+ align-items: center;
468
+ justify-content: center;
469
+ position: relative;
470
+
471
+ &::after {
472
+ content: "";
473
+ display: inline-block;
474
+ width: 32px; /* Explicitly setting width to 32 pixels */
475
+ height: 32px; /* Explicitly setting height to 32 pixels */
476
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIyTDggMTZMMTIgMTBNMjAgMjJMMjQgMTZMIDIwIDEwIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=");
477
+ background-size: contain;
478
+ background-repeat: no-repeat;
479
+ background-position: center; /* Center the SVG */
480
+ margin-top: 0.5rem;
481
+ }
482
+
483
+ &.active {
484
+ box-shadow: 0 0 0 3px var(--opeanpi-code-tab-shadow-color-shell);
485
+ border-color: var(--openapi-code-tab-border-color-shell);
486
+ }
487
+ }
488
+
439
489
  @media only screen and (min-width: 768px) and (max-width: 996px) {
440
490
  .openapi-tabs__code-list {
441
491
  justify-content: space-around;
@@ -52,6 +52,7 @@ export default function DocItemLayout({ children }: Props): JSX.Element {
52
52
  const { metadata } = useDoc();
53
53
  const { frontMatter } = useDoc();
54
54
  const api = frontMatter.api;
55
+ const schema = frontMatter.schema;
55
56
  return (
56
57
  <div className="row">
57
58
  <div className={clsx("col", !docTOC.hidden && styles.docItemCol)}>
@@ -64,13 +65,15 @@ export default function DocItemLayout({ children }: Props): JSX.Element {
64
65
  {docTOC.mobile}
65
66
  <DocItemContent>{children}</DocItemContent>
66
67
  <div className="row">
67
- <div className={clsx("col", api ? "col--7" : "col--12")}>
68
+ <div
69
+ className={clsx("col", api || schema ? "col--7" : "col--12")}
70
+ >
68
71
  <DocItemFooter />
69
72
  </div>
70
73
  </div>
71
74
  </article>
72
75
  <div className="row">
73
- <div className={clsx("col", api ? "col--7" : "col--12")}>
76
+ <div className={clsx("col", api || schema ? "col--7" : "col--12")}>
74
77
  <DocItemPaginator />
75
78
  </div>
76
79
  </div>
@@ -18,8 +18,10 @@ import useIsBrowser from "@docusaurus/useIsBrowser";
18
18
  import { createAuth } from "@theme/ApiExplorer/Authorization/slice";
19
19
  import { createPersistanceMiddleware } from "@theme/ApiExplorer/persistanceMiddleware";
20
20
  import DocItemLayout from "@theme/ApiItem/Layout";
21
+ import CodeBlock from "@theme/CodeBlock";
21
22
  import type { Props } from "@theme/DocItem";
22
23
  import DocItemMetadata from "@theme/DocItem/Metadata";
24
+ import SkeletonLoader from "@theme/SkeletonLoader";
23
25
  import clsx from "clsx";
24
26
  import { ServerObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
25
27
  import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
@@ -46,6 +48,10 @@ interface SchemaFrontMatter extends DocFrontMatter {
46
48
  readonly schema?: boolean;
47
49
  }
48
50
 
51
+ interface SampleFrontMatter extends DocFrontMatter {
52
+ readonly sample?: any;
53
+ }
54
+
49
55
  // @ts-ignore
50
56
  export default function ApiItem(props: Props): JSX.Element {
51
57
  const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
@@ -54,6 +60,7 @@ export default function ApiItem(props: Props): JSX.Element {
54
60
  const { info_path: infoPath } = frontMatter as DocFrontMatter;
55
61
  let { api } = frontMatter as ApiFrontMatter;
56
62
  const { schema } = frontMatter as SchemaFrontMatter;
63
+ const { sample } = frontMatter as SampleFrontMatter;
57
64
  // decompress and parse
58
65
  if (api) {
59
66
  try {
@@ -152,7 +159,7 @@ export default function ApiItem(props: Props): JSX.Element {
152
159
  <MDXComponent />
153
160
  </div>
154
161
  <div className="col col--5 openapi-right-panel__container">
155
- <BrowserOnly fallback={<div>Loading...</div>}>
162
+ <BrowserOnly fallback={<SkeletonLoader size="lg" />}>
156
163
  {() => {
157
164
  return <ApiExplorer item={api} infoPath={infoPath} />;
158
165
  }}
@@ -171,9 +178,14 @@ export default function ApiItem(props: Props): JSX.Element {
171
178
  <DocItemMetadata />
172
179
  <DocItemLayout>
173
180
  <div className={clsx("row", "theme-api-markdown")}>
174
- <div className="col col--12">
181
+ <div className="col col--7 openapi-left-panel__container schema">
175
182
  <MDXComponent />
176
183
  </div>
184
+ <div className="col col--5 openapi-right-panel__container">
185
+ <CodeBlock language="json" title={`${frontMatter.title}`}>
186
+ {JSON.stringify(sample, null, 2)}
187
+ </CodeBlock>
188
+ </div>
177
189
  </div>
178
190
  </DocItemLayout>
179
191
  </HtmlClassNameProvider>
@@ -6,7 +6,6 @@
6
6
  * ========================================================================== */
7
7
  .openapi-tabs__container {
8
8
  margin-left: -1px;
9
- margin-bottom: var(--ifm-leading);
10
9
  }
11
10
 
12
11
  .openapi-tabs__response-header {
@@ -0,0 +1,37 @@
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
+ export const OpeningArrayBracket = () => (
11
+ <li>
12
+ <div
13
+ style={{
14
+ fontSize: "var(--ifm-code-font-size)",
15
+ opacity: 0.6,
16
+ marginLeft: "-.5rem",
17
+ paddingBottom: ".5rem",
18
+ }}
19
+ >
20
+ Array [
21
+ </div>
22
+ </li>
23
+ );
24
+
25
+ export const ClosingArrayBracket = () => (
26
+ <li>
27
+ <div
28
+ style={{
29
+ fontSize: "var(--ifm-code-font-size)",
30
+ opacity: 0.6,
31
+ marginLeft: "-.5rem",
32
+ }}
33
+ >
34
+ ]
35
+ </div>
36
+ </li>
37
+ );