docusaurus-theme-openapi-docs 0.0.0-beta.660 → 0.0.0-beta.662

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.
@@ -279,7 +279,11 @@ function Body({
279
279
  { className: "openapi-tabs__schema", lazy: true },
280
280
  react_1.default.createElement(
281
281
  TabItem_1.default,
282
- { label: "Default", value: "default", default: true },
282
+ {
283
+ label: "Example (from schema)",
284
+ value: "Example (from schema)",
285
+ default: true,
286
+ },
283
287
  react_1.default.createElement(
284
288
  LiveEditor_1.default,
285
289
  { action: dispatch, language: language, required: required },
@@ -308,7 +312,11 @@ function Body({
308
312
  { className: "openapi-tabs__schema", lazy: true },
309
313
  react_1.default.createElement(
310
314
  TabItem_1.default,
311
- { label: "Default", value: "default", default: true },
315
+ {
316
+ label: "Example (from schema)",
317
+ value: "Example (from schema)",
318
+ default: true,
319
+ },
312
320
  react_1.default.createElement(
313
321
  LiveEditor_1.default,
314
322
  { action: dispatch, language: language, required: required },
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ const zlib_1 = __importDefault(require("zlib"));
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
16
17
  const ExecutionEnvironment_1 = __importDefault(
@@ -38,7 +39,13 @@ function ApiItem(props) {
38
39
  const MDXComponent = props.content;
39
40
  const { frontMatter } = MDXComponent;
40
41
  const { info_path: infoPath } = frontMatter;
41
- const { api } = frontMatter;
42
+ let { api } = frontMatter;
43
+ // decompress and parse
44
+ if (api) {
45
+ api = JSON.parse(
46
+ zlib_1.default.inflateSync(Buffer.from(api, "base64")).toString()
47
+ );
48
+ }
42
49
  const { siteConfig } = (0, useDocusaurusContext_1.default)();
43
50
  const themeConfig = siteConfig.themeConfig;
44
51
  const options = themeConfig.api;
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-beta.660",
4
+ "version": "0.0.0-beta.662",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -44,7 +44,7 @@
44
44
  "clsx": "^1.1.1",
45
45
  "copy-text-to-clipboard": "^3.1.0",
46
46
  "crypto-js": "^4.1.1",
47
- "docusaurus-plugin-openapi-docs": "0.0.0-beta.660",
47
+ "docusaurus-plugin-openapi-docs": "0.0.0-beta.662",
48
48
  "docusaurus-plugin-sass": "^0.2.3",
49
49
  "file-saver": "^2.0.5",
50
50
  "lodash": "^4.17.20",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "ab105a0abb66443e79dc1331b05b874f362d894f"
71
+ "gitHead": "795ea43669b5067b900527b42dc18d97a0534af9"
72
72
  }
@@ -290,7 +290,11 @@ function Body({
290
290
  <FormItem>
291
291
  <SchemaTabs className="openapi-tabs__schema" lazy>
292
292
  {/* @ts-ignore */}
293
- <TabItem label="Default" value="default" default>
293
+ <TabItem
294
+ label="Example (from schema)"
295
+ value="Example (from schema)"
296
+ default
297
+ >
294
298
  <LiveApp action={dispatch} language={language} required={required}>
295
299
  {defaultBody}
296
300
  </LiveApp>
@@ -317,7 +321,11 @@ function Body({
317
321
  <FormItem className="openapi-explorer__form-item-body-container">
318
322
  <SchemaTabs className="openapi-tabs__schema" lazy>
319
323
  {/* @ts-ignore */}
320
- <TabItem label="Default" value="default" default>
324
+ <TabItem
325
+ label="Example (from schema)"
326
+ value="Example (from schema)"
327
+ default
328
+ >
321
329
  <LiveApp action={dispatch} language={language} required={required}>
322
330
  {defaultBody}
323
331
  </LiveApp>
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
+ import zlib from "zlib";
9
+
8
10
  import React from "react";
9
11
 
10
12
  import BrowserOnly from "@docusaurus/BrowserOnly";
@@ -47,7 +49,14 @@ export default function ApiItem(props: Props): JSX.Element {
47
49
  const MDXComponent = props.content;
48
50
  const { frontMatter } = MDXComponent;
49
51
  const { info_path: infoPath } = frontMatter as DocFrontMatter;
50
- const { api } = frontMatter as ApiFrontMatter;
52
+ let { api } = frontMatter as ApiFrontMatter;
53
+ // decompress and parse
54
+ if (api) {
55
+ api = JSON.parse(
56
+ zlib.inflateSync(Buffer.from(api as any, "base64")).toString()
57
+ );
58
+ }
59
+
51
60
  const { siteConfig } = useDocusaurusContext();
52
61
  const themeConfig = siteConfig.themeConfig as ThemeConfig;
53
62
  const options = themeConfig.api;