docusaurus-plugin-openapi-docs 2.0.0-beta.3 → 2.0.0-beta.4

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.
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sampleRequestFromSchema = void 0;
13
13
  const chalk_1 = __importDefault(require("chalk"));
14
14
  const merge_1 = __importDefault(require("lodash/merge"));
15
- const createRequestSchema_1 = require("../markdown/createRequestSchema");
15
+ const createSchema_1 = require("../markdown/createSchema");
16
16
  const primitives = {
17
17
  string: {
18
18
  default: () => "string",
@@ -51,7 +51,7 @@ function sampleRequestFromProp(name, prop, obj) {
51
51
  obj[name] = (0, exports.sampleRequestFromSchema)(prop.anyOf[0]);
52
52
  }
53
53
  else if (prop.allOf) {
54
- const { mergedSchemas } = (0, createRequestSchema_1.mergeAllOf)(prop.allOf);
54
+ const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(prop.allOf);
55
55
  sampleRequestFromProp(name, mergedSchemas, obj);
56
56
  }
57
57
  else {
@@ -86,7 +86,7 @@ const sampleRequestFromSchema = (schema = {}) => {
86
86
  return (0, exports.sampleRequestFromSchema)(anyOf[0]);
87
87
  }
88
88
  if (allOf) {
89
- const { mergedSchemas } = (0, createRequestSchema_1.mergeAllOf)(allOf);
89
+ const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(allOf);
90
90
  if (mergedSchemas.properties) {
91
91
  for (const [key, value] of Object.entries(mergedSchemas.properties)) {
92
92
  if ((value.readOnly && value.readOnly === true) || value.deprecated) {
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sampleResponseFromSchema = void 0;
13
13
  const chalk_1 = __importDefault(require("chalk"));
14
14
  const merge_1 = __importDefault(require("lodash/merge"));
15
- const createResponseSchema_1 = require("../markdown/createResponseSchema");
15
+ const createSchema_1 = require("../markdown/createSchema");
16
16
  const primitives = {
17
17
  string: {
18
18
  default: () => "string",
@@ -51,7 +51,7 @@ function sampleResponseFromProp(name, prop, obj) {
51
51
  obj[name] = (0, exports.sampleResponseFromSchema)(prop.anyOf[0]);
52
52
  }
53
53
  else if (prop.allOf) {
54
- const { mergedSchemas } = (0, createResponseSchema_1.mergeAllOf)(prop.allOf);
54
+ const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(prop.allOf);
55
55
  sampleResponseFromProp(name, mergedSchemas, obj);
56
56
  }
57
57
  else {
@@ -68,7 +68,7 @@ const sampleResponseFromSchema = (schema = {}) => {
68
68
  return example;
69
69
  }
70
70
  if (allOf) {
71
- const { mergedSchemas } = (0, createResponseSchema_1.mergeAllOf)(allOf);
71
+ const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(allOf);
72
72
  if (mergedSchemas.properties) {
73
73
  for (const [key, value] of Object.entries(mergedSchemas.properties)) {
74
74
  if ((value.writeOnly && value.writeOnly === true) ||
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-openapi-docs",
3
3
  "description": "OpenAPI plugin for Docusaurus.",
4
- "version": "2.0.0-beta.3",
4
+ "version": "2.0.0-beta.4",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14"
62
62
  },
63
- "gitHead": "f02561b29cdee2dfa56ccf0ea1a63f9324d8044c"
63
+ "gitHead": "d7c1319c7977c3e7c54827b3950e5c9b66106e30"
64
64
  }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  import fs from "fs";
9
9
  import path from "path";
10
+ import zlib from "zlib";
10
11
 
11
12
  import type { LoadContext, Plugin } from "@docusaurus/types";
12
13
  import { Globby, posixPath } from "@docusaurus/utils";
@@ -244,7 +245,16 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
244
245
  }
245
246
  }
246
247
  if (item.type === "api") {
247
- item.json = JSON.stringify(item.api);
248
+ // opportunity to compress JSON
249
+ // const serialize = (o: any) => {
250
+ // return zlib.deflateSync(JSON.stringify(o)).toString("base64");
251
+ // };
252
+ // const deserialize = (s: any) => {
253
+ // return zlib.inflateSync(Buffer.from(s, "base64")).toString();
254
+ // };
255
+ item.json = zlib
256
+ .deflateSync(JSON.stringify(item.api))
257
+ .toString("base64");
248
258
  let infoBasePath = `${outputDir}/${item.infoId}`;
249
259
  if (docRouteBasePath) {
250
260
  infoBasePath = `${docRouteBasePath}/${outputDir