docusaurus-plugin-openapi-docs 0.0.0-433 → 0.0.0-434

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.
@@ -25,6 +25,7 @@ function mergeAllOf(allOf) {
25
25
  example: function () {
26
26
  return true;
27
27
  },
28
+ ignoreAdditionalProperties: true,
28
29
  },
29
30
  });
30
31
  const required = allOf.reduce((acc, cur) => {
@@ -1,4 +1,11 @@
1
- import { MediaTypeObject } from "../openapi/types";
1
+ import { MediaTypeObject, SchemaObject } from "../openapi/types";
2
+ /**
3
+ * Returns a merged representation of allOf array of schemas.
4
+ */
5
+ export declare function mergeAllOf(allOf: SchemaObject[]): {
6
+ mergedSchemas: any;
7
+ required: any;
8
+ };
2
9
  interface Props {
3
10
  style?: any;
4
11
  title: string;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createResponseSchema = void 0;
9
+ exports.createResponseSchema = exports.mergeAllOf = void 0;
10
10
  const createDescription_1 = require("./createDescription");
11
11
  const createDetails_1 = require("./createDetails");
12
12
  const createDetailsSummary_1 = require("./createDetailsSummary");
@@ -27,6 +27,7 @@ function mergeAllOf(allOf) {
27
27
  return true;
28
28
  },
29
29
  },
30
+ ignoreAdditionalProperties: true,
30
31
  });
31
32
  const required = allOf.reduce((acc, cur) => {
32
33
  if (Array.isArray(cur.required)) {
@@ -37,6 +38,7 @@ function mergeAllOf(allOf) {
37
38
  }, []);
38
39
  return { mergedSchemas, required };
39
40
  }
41
+ exports.mergeAllOf = mergeAllOf;
40
42
  /**
41
43
  * For handling nested anyOf/oneOf.
42
44
  */
@@ -11,7 +11,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sampleResponseFromSchema = void 0;
13
13
  const chalk_1 = __importDefault(require("chalk"));
14
- const createRequestSchema_1 = require("../markdown/createRequestSchema");
14
+ const createResponseSchema_1 = require("../markdown/createResponseSchema");
15
15
  const primitives = {
16
16
  string: {
17
17
  default: () => "string",
@@ -50,7 +50,7 @@ function sampleResponseFromProp(name, prop, obj) {
50
50
  obj[name] = (0, exports.sampleResponseFromSchema)(prop.anyOf[0]);
51
51
  }
52
52
  else if (prop.allOf) {
53
- const { mergedSchemas } = (0, createRequestSchema_1.mergeAllOf)(prop.allOf);
53
+ const { mergedSchemas } = (0, createResponseSchema_1.mergeAllOf)(prop.allOf);
54
54
  sampleResponseFromProp(name, mergedSchemas, obj);
55
55
  }
56
56
  else {
@@ -65,7 +65,7 @@ const sampleResponseFromSchema = (schema = {}) => {
65
65
  return example;
66
66
  }
67
67
  if (allOf) {
68
- const { mergedSchemas } = (0, createRequestSchema_1.mergeAllOf)(allOf);
68
+ const { mergedSchemas } = (0, createResponseSchema_1.mergeAllOf)(allOf);
69
69
  if (mergedSchemas.properties) {
70
70
  for (const [key, value] of Object.entries(mergedSchemas.properties)) {
71
71
  if (value.readOnly && value.readOnly === 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": "0.0.0-433",
4
+ "version": "0.0.0-434",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "e3e99aa7627392218adc006b4918390d3efd7b3d"
71
+ "gitHead": "9d1c07ac33c8a476a61408c6c86e78c51c534af3"
72
72
  }
@@ -26,6 +26,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
26
26
  example: function () {
27
27
  return true;
28
28
  },
29
+ ignoreAdditionalProperties: true,
29
30
  },
30
31
  });
31
32
 
@@ -22,7 +22,7 @@ const jsonSchemaMergeAllOf = require("json-schema-merge-allof");
22
22
  /**
23
23
  * Returns a merged representation of allOf array of schemas.
24
24
  */
25
- function mergeAllOf(allOf: SchemaObject[]) {
25
+ export function mergeAllOf(allOf: SchemaObject[]) {
26
26
  const mergedSchemas = jsonSchemaMergeAllOf(allOf, {
27
27
  resolvers: {
28
28
  readOnly: function () {
@@ -32,6 +32,7 @@ function mergeAllOf(allOf: SchemaObject[]) {
32
32
  return true;
33
33
  },
34
34
  },
35
+ ignoreAdditionalProperties: true,
35
36
  });
36
37
 
37
38
  const required = allOf.reduce((acc, cur) => {
@@ -639,7 +640,6 @@ function createNodes(schema: SchemaObject): any {
639
640
 
640
641
  if (schema.allOf !== undefined) {
641
642
  const { mergedSchemas } = mergeAllOf(schema.allOf);
642
-
643
643
  // allOf seems to always result in properties
644
644
  if (mergedSchemas.properties !== undefined) {
645
645
  return createProperties(mergedSchemas);
@@ -7,7 +7,7 @@
7
7
 
8
8
  import chalk from "chalk";
9
9
 
10
- import { mergeAllOf } from "../markdown/createRequestSchema";
10
+ import { mergeAllOf } from "../markdown/createResponseSchema";
11
11
  import { SchemaObject } from "./types";
12
12
 
13
13
  interface OASTypeToTypeMap {