docusaurus-plugin-openapi-docs 0.0.0-419 → 0.0.0-422

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.
@@ -7,8 +7,8 @@
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.createRequestBodyDetails = void 0;
10
- const createSchemaDetails_1 = require("./createSchemaDetails");
10
+ const createRequestSchema_1 = require("./createRequestSchema");
11
11
  function createRequestBodyDetails({ title, body }) {
12
- return (0, createSchemaDetails_1.createSchemaDetails)({ title, body });
12
+ return (0, createRequestSchema_1.createRequestSchema)({ title, body });
13
13
  }
14
14
  exports.createRequestBodyDetails = createRequestBodyDetails;
@@ -0,0 +1,21 @@
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
+ };
9
+ interface Props {
10
+ style?: any;
11
+ title: string;
12
+ body: {
13
+ content?: {
14
+ [key: string]: MediaTypeObject;
15
+ };
16
+ description?: string;
17
+ required?: string[] | boolean;
18
+ };
19
+ }
20
+ export declare function createRequestSchema({ title, body, ...rest }: Props): string | undefined;
21
+ export {};
@@ -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.createSchemaDetails = void 0;
9
+ exports.createRequestSchema = 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");
@@ -36,6 +36,7 @@ function mergeAllOf(allOf) {
36
36
  }, []);
37
37
  return { mergedSchemas, required };
38
38
  }
39
+ exports.mergeAllOf = mergeAllOf;
39
40
  /**
40
41
  * For handling nested anyOf/oneOf.
41
42
  */
@@ -428,7 +429,6 @@ function createPropertyDiscriminator(name, schemaName, schema, discriminator, re
428
429
  function createEdges({ name, schema, required, discriminator, }) {
429
430
  var _a, _b;
430
431
  const schemaName = (0, schema_1.getSchemaName)(schema);
431
- // if (name === "id") console.log(name, schema, required);
432
432
  if (discriminator !== undefined && discriminator.propertyName === name) {
433
433
  return createPropertyDiscriminator(name, "string", schema, discriminator, required);
434
434
  }
@@ -452,6 +452,9 @@ function createEdges({ name, schema, required, discriminator, }) {
452
452
  if (((_a = mergedSchemas.items) === null || _a === void 0 ? void 0 : _a.properties) !== undefined) {
453
453
  return createDetailsNode(name, mergedSchemaName, mergedSchemas, required);
454
454
  }
455
+ if (mergedSchemas.readOnly && mergedSchemas.readOnly === true) {
456
+ return undefined;
457
+ }
455
458
  return (0, utils_1.create)("SchemaItem", {
456
459
  collapsible: false,
457
460
  name,
@@ -459,7 +462,7 @@ function createEdges({ name, schema, required, discriminator, }) {
459
462
  schemaDescription: mergedSchemas.description,
460
463
  schemaName: schemaName,
461
464
  qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
462
- defaultValue: schema.default,
465
+ defaultValue: mergedSchemas.default,
463
466
  });
464
467
  }
465
468
  if (schema.properties !== undefined) {
@@ -472,6 +475,9 @@ function createEdges({ name, schema, required, discriminator, }) {
472
475
  if (((_b = schema.items) === null || _b === void 0 ? void 0 : _b.properties) !== undefined) {
473
476
  return createDetailsNode(name, schemaName, schema, required);
474
477
  }
478
+ if (schema.readOnly && schema.readOnly === true) {
479
+ return undefined;
480
+ }
475
481
  // primitives and array of non-objects
476
482
  return (0, utils_1.create)("SchemaItem", {
477
483
  collapsible: false,
@@ -536,7 +542,7 @@ function createNodes(schema) {
536
542
  // So far, haven't seen this hit in testing
537
543
  return undefined;
538
544
  }
539
- function createSchemaDetails({ title, body, ...rest }) {
545
+ function createRequestSchema({ title, body, ...rest }) {
540
546
  if (body === undefined ||
541
547
  body.content === undefined ||
542
548
  Object.keys(body).length === 0 ||
@@ -671,4 +677,4 @@ function createSchemaDetails({ title, body, ...rest }) {
671
677
  ],
672
678
  });
673
679
  }
674
- exports.createSchemaDetails = createSchemaDetails;
680
+ exports.createRequestSchema = createRequestSchema;
@@ -10,5 +10,5 @@ interface Props {
10
10
  required?: string[] | boolean;
11
11
  };
12
12
  }
13
- export declare function createSchemaDetails({ title, body, ...rest }: Props): string | undefined;
13
+ export declare function createResponseSchema({ title, body, ...rest }: Props): string | undefined;
14
14
  export {};