docusaurus-plugin-openapi-docs 0.0.0-934 → 0.0.0-940

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/index.js CHANGED
@@ -203,7 +203,11 @@ title: "{{{title}}}"
203
203
  description: "{{{frontMatter.description}}}"
204
204
  sidebar_label: "{{{title}}}"
205
205
  hide_title: true
206
+ {{#schema}}
207
+ hide_table_of_contents: true
208
+ {{/schema}}
206
209
  schema: true
210
+ sample: {{{frontMatter.sample}}}
207
211
  custom_edit_url: null
208
212
  ---
209
213
 
@@ -21,7 +21,6 @@ const createMethodEndpoint_1 = require("./createMethodEndpoint");
21
21
  const createParamsDetails_1 = require("./createParamsDetails");
22
22
  const createRequestBodyDetails_1 = require("./createRequestBodyDetails");
23
23
  const createRequestHeader_1 = require("./createRequestHeader");
24
- const createSchema_1 = require("./createSchema");
25
24
  const createStatusCodes_1 = require("./createStatusCodes");
26
25
  const createTermsOfService_1 = require("./createTermsOfService");
27
26
  const createVendorExtensions_1 = require("./createVendorExtensions");
@@ -81,15 +80,13 @@ exports.createTagPageMD = createTagPageMD;
81
80
  function createSchemaPageMD({ schema }) {
82
81
  const { title = "", description } = schema;
83
82
  return (0, utils_1.render)([
84
- `import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
85
- `import SchemaItem from "@theme/SchemaItem";\n`,
86
- `import SchemaTabs from "@theme/SchemaTabs";\n`,
87
- `import Heading from "@theme/Heading";\n`,
88
- `import TabItem from "@theme/TabItem";\n\n`,
83
+ `import Schema from "@theme/Schema";\n`,
84
+ `import Heading from "@theme/Heading";\n\n`,
89
85
  (0, createHeading_1.createHeading)(title.replace(utils_1.lessThan, "<").replace(utils_1.greaterThan, ">")),
90
86
  (0, createDescription_1.createDescription)(description),
91
- (0, utils_1.create)("ul", {
92
- children: (0, createSchema_1.createNodes)(schema, "response"),
87
+ (0, utils_1.create)("Schema", {
88
+ schema: schema,
89
+ schemaType: "response",
93
90
  }),
94
91
  ]);
95
92
  }
@@ -22,6 +22,7 @@ const openapi_to_postmanv2_1 = __importDefault(require("openapi-to-postmanv2"));
22
22
  const postman_collection_1 = __importDefault(require("postman-collection"));
23
23
  const createRequestExample_1 = require("./createRequestExample");
24
24
  const index_1 = require("../index");
25
+ const createResponseExample_1 = require("./createResponseExample");
25
26
  const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
26
27
  /**
27
28
  * Convenience function for converting raw JSON to a Postman Collection object.
@@ -355,6 +356,7 @@ function createItems(openapiData, options, sidebarOptions) {
355
356
  .replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
356
357
  .replace(/\s+$/, "")
357
358
  : "",
359
+ sample: JSON.stringify((0, createResponseExample_1.sampleResponseFromSchema)(schemaObject)),
358
360
  },
359
361
  schema: schemaObject,
360
362
  };
package/lib/options.js CHANGED
@@ -23,6 +23,7 @@ const markdownGenerators = utils_validation_1.Joi.object({
23
23
  createApiPageMD: utils_validation_1.Joi.function(),
24
24
  createInfoPageMD: utils_validation_1.Joi.function(),
25
25
  createTagPageMD: utils_validation_1.Joi.function(),
26
+ createSchemaPageMD: utils_validation_1.Joi.function(),
26
27
  });
27
28
  exports.OptionsSchema = utils_validation_1.Joi.object({
28
29
  id: utils_validation_1.Joi.string().required(),
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": "0.0.0-934",
4
+ "version": "0.0.0-940",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=14"
64
64
  },
65
- "gitHead": "23c20cde70c5311d6879b113665ceddc84d1febc"
65
+ "gitHead": "73fe6a842a36f1da27cb0c22d2fa260b268739d6"
66
66
  }
package/src/index.ts CHANGED
@@ -278,7 +278,11 @@ title: "{{{title}}}"
278
278
  description: "{{{frontMatter.description}}}"
279
279
  sidebar_label: "{{{title}}}"
280
280
  hide_title: true
281
+ {{#schema}}
282
+ hide_table_of_contents: true
283
+ {{/schema}}
281
284
  schema: true
285
+ sample: {{{frontMatter.sample}}}
282
286
  custom_edit_url: null
283
287
  ---
284
288
 
@@ -19,7 +19,6 @@ import { createMethodEndpoint } from "./createMethodEndpoint";
19
19
  import { createParamsDetails } from "./createParamsDetails";
20
20
  import { createRequestBodyDetails } from "./createRequestBodyDetails";
21
21
  import { createRequestHeader } from "./createRequestHeader";
22
- import { createNodes } from "./createSchema";
23
22
  import { createStatusCodes } from "./createStatusCodes";
24
23
  import { createTermsOfService } from "./createTermsOfService";
25
24
  import { createVendorExtensions } from "./createVendorExtensions";
@@ -133,15 +132,13 @@ export function createTagPageMD({ tag: { description } }: TagPageMetadata) {
133
132
  export function createSchemaPageMD({ schema }: SchemaPageMetadata) {
134
133
  const { title = "", description } = schema;
135
134
  return render([
136
- `import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
137
- `import SchemaItem from "@theme/SchemaItem";\n`,
138
- `import SchemaTabs from "@theme/SchemaTabs";\n`,
139
- `import Heading from "@theme/Heading";\n`,
140
- `import TabItem from "@theme/TabItem";\n\n`,
135
+ `import Schema from "@theme/Schema";\n`,
136
+ `import Heading from "@theme/Heading";\n\n`,
141
137
  createHeading(title.replace(lessThan, "<").replace(greaterThan, ">")),
142
138
  createDescription(description),
143
- create("ul", {
144
- children: createNodes(schema, "response"),
139
+ create("Schema", {
140
+ schema: schema,
141
+ schemaType: "response",
145
142
  }),
146
143
  ]);
147
144
  }
@@ -30,6 +30,7 @@ import {
30
30
  SidebarOptions,
31
31
  TagPageMetadata,
32
32
  } from "../types";
33
+ import { sampleResponseFromSchema } from "./createResponseExample";
33
34
  import { loadAndResolveSpec } from "./utils/loadAndResolveSpec";
34
35
 
35
36
  /**
@@ -451,6 +452,7 @@ function createItems(
451
452
  .replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
452
453
  .replace(/\s+$/, "")
453
454
  : "",
455
+ sample: JSON.stringify(sampleResponseFromSchema(schemaObject)),
454
456
  },
455
457
  schema: schemaObject,
456
458
  };
package/src/options.ts CHANGED
@@ -24,6 +24,7 @@ const markdownGenerators = Joi.object({
24
24
  createApiPageMD: Joi.function(),
25
25
  createInfoPageMD: Joi.function(),
26
26
  createTagPageMD: Joi.function(),
27
+ createSchemaPageMD: Joi.function(),
27
28
  });
28
29
 
29
30
  export const OptionsSchema = Joi.object({