docusaurus-plugin-openapi-docs 0.0.0-799 → 0.0.0-822

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.
@@ -35,10 +35,16 @@ function createParamsDetails({ parameters, type }) {
35
35
  (0, utils_1.create)("div", {
36
36
  children: [
37
37
  (0, utils_1.create)("ul", {
38
- children: params.map((param) => (0, utils_1.create)("ParamsItem", {
39
- className: "paramsItem",
40
- param: param,
41
- })),
38
+ children: params.map((param) => {
39
+ var _a, _b, _c;
40
+ return (0, utils_1.create)("ParamsItem", {
41
+ className: "paramsItem",
42
+ param: {
43
+ ...param,
44
+ enumDescriptions: Object.entries((_c = (_b = (_a = param === null || param === void 0 ? void 0 : param.schema) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b["x-enumDescriptions"]) !== null && _c !== void 0 ? _c : {}),
45
+ },
46
+ });
47
+ }),
42
48
  }),
43
49
  ],
44
50
  }),
@@ -351,14 +351,14 @@ function createDetailsNode(name, schemaName, schema, required, nullable) {
351
351
  (0, utils_1.create)("div", {
352
352
  style: { marginLeft: "1rem" },
353
353
  children: [
354
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema), (message) => (0, utils_1.create)("div", {
355
- style: { marginTop: ".5rem", marginBottom: ".5rem" },
356
- children: (0, createDescription_1.createDescription)(message),
357
- })),
358
354
  (0, utils_1.guard)(schema.description, (description) => (0, utils_1.create)("div", {
359
355
  style: { marginTop: ".5rem", marginBottom: ".5rem" },
360
356
  children: (0, createDescription_1.createDescription)(description),
361
357
  })),
358
+ (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema), (message) => (0, utils_1.create)("div", {
359
+ style: { marginTop: ".5rem", marginBottom: ".5rem" },
360
+ children: (0, createDescription_1.createDescription)(message),
361
+ })),
362
362
  createNodes(schema, SCHEMA_TYPE),
363
363
  ],
364
364
  }),
@@ -478,17 +478,17 @@ function createPropertyDiscriminator(name, schemaName, schema, discriminator, re
478
478
  ]),
479
479
  ],
480
480
  }),
481
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(discriminator), (message) => (0, utils_1.create)("div", {
481
+ (0, utils_1.guard)(schema.description, (description) => (0, utils_1.create)("div", {
482
482
  style: {
483
483
  paddingLeft: "1rem",
484
484
  },
485
- children: (0, createDescription_1.createDescription)(message),
485
+ children: (0, createDescription_1.createDescription)(description),
486
486
  })),
487
- (0, utils_1.guard)(schema.description, (description) => (0, utils_1.create)("div", {
487
+ (0, utils_1.guard)((0, schema_1.getQualifierMessage)(discriminator), (message) => (0, utils_1.create)("div", {
488
488
  style: {
489
489
  paddingLeft: "1rem",
490
490
  },
491
- children: (0, createDescription_1.createDescription)(description),
491
+ children: (0, createDescription_1.createDescription)(message),
492
492
  })),
493
493
  (0, utils_1.create)("DiscriminatorTabs", {
494
494
  className: "openapi-tabs__discriminator",
@@ -163,6 +163,7 @@ export interface ParameterObject {
163
163
  examples?: Map<ExampleObject>;
164
164
  content?: Map<MediaTypeObject>;
165
165
  param?: Object;
166
+ "x-enumDescriptions"?: Record<string, string>;
166
167
  }
167
168
  export interface ParameterObjectWithRef {
168
169
  name: string;
@@ -279,6 +280,7 @@ export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf"
279
280
  example?: any;
280
281
  deprecated?: boolean;
281
282
  "x-tags"?: string[];
283
+ "x-enumDescriptions"?: Record<string, string>;
282
284
  };
283
285
  export type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
284
286
  type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
@@ -215,7 +215,7 @@ class OpenAPIParser {
215
215
  })
216
216
  .filter((child) => child !== undefined);
217
217
  for (const { $ref: subSchemaRef, schema: subSchema } of allOfSchemas) {
218
- const { type, enum: enumProperty, properties, items, required, oneOf, anyOf, title, ...otherConstraints } = subSchema;
218
+ const { type, enum: enumProperty, "x-enumDescription": enumDescription, properties, items, required, oneOf, anyOf, title, ...otherConstraints } = subSchema;
219
219
  if (receiver.type !== type &&
220
220
  receiver.type !== undefined &&
221
221
  type !== undefined) {
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-799",
4
+ "version": "0.0.0-822",
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": "28c09c7a8fb4deca3a0f985409033272f1b55eb4"
65
+ "gitHead": "45cf7902efde96e5b560f34d68113cfccda9f174"
66
66
  }
@@ -43,12 +43,17 @@ export function createParamsDetails({ parameters, type }: Props) {
43
43
  create("div", {
44
44
  children: [
45
45
  create("ul", {
46
- children: params.map((param) =>
47
- create("ParamsItem", {
46
+ children: params.map((param) => {
47
+ return create("ParamsItem", {
48
48
  className: "paramsItem",
49
- param: param,
50
- })
51
- ),
49
+ param: {
50
+ ...param,
51
+ enumDescriptions: Object.entries(
52
+ param?.schema?.items?.["x-enumDescriptions"] ?? {}
53
+ ),
54
+ },
55
+ });
56
+ }),
52
57
  }),
53
58
  ],
54
59
  }),
@@ -416,16 +416,16 @@ function createDetailsNode(
416
416
  create("div", {
417
417
  style: { marginLeft: "1rem" },
418
418
  children: [
419
- guard(getQualifierMessage(schema), (message) =>
419
+ guard(schema.description, (description) =>
420
420
  create("div", {
421
421
  style: { marginTop: ".5rem", marginBottom: ".5rem" },
422
- children: createDescription(message),
422
+ children: createDescription(description),
423
423
  })
424
424
  ),
425
- guard(schema.description, (description) =>
425
+ guard(getQualifierMessage(schema), (message) =>
426
426
  create("div", {
427
427
  style: { marginTop: ".5rem", marginBottom: ".5rem" },
428
- children: createDescription(description),
428
+ children: createDescription(message),
429
429
  })
430
430
  ),
431
431
  createNodes(schema, SCHEMA_TYPE),
@@ -559,20 +559,20 @@ function createPropertyDiscriminator(
559
559
  ]),
560
560
  ],
561
561
  }),
562
- guard(getQualifierMessage(discriminator), (message) =>
562
+ guard(schema.description, (description) =>
563
563
  create("div", {
564
564
  style: {
565
565
  paddingLeft: "1rem",
566
566
  },
567
- children: createDescription(message),
567
+ children: createDescription(description),
568
568
  })
569
569
  ),
570
- guard(schema.description, (description) =>
570
+ guard(getQualifierMessage(discriminator), (message) =>
571
571
  create("div", {
572
572
  style: {
573
573
  paddingLeft: "1rem",
574
574
  },
575
- children: createDescription(description),
575
+ children: createDescription(message),
576
576
  })
577
577
  ),
578
578
  create("DiscriminatorTabs", {
@@ -197,6 +197,7 @@ export interface ParameterObject {
197
197
  param?: Object;
198
198
  // ignoring stylings: matrix, label, form, simple, spaceDelimited,
199
199
  // pipeDelimited and deepObject
200
+ "x-enumDescriptions"?: Record<string, string>;
200
201
  }
201
202
 
202
203
  export interface ParameterObjectWithRef {
@@ -353,6 +354,7 @@ export type SchemaObject = Omit<
353
354
  example?: any;
354
355
  deprecated?: boolean;
355
356
  "x-tags"?: string[];
357
+ "x-enumDescriptions"?: Record<string, string>;
356
358
  };
357
359
 
358
360
  export type SchemaObjectWithRef = Omit<
@@ -270,6 +270,7 @@ export class OpenAPIParser {
270
270
  const {
271
271
  type,
272
272
  enum: enumProperty,
273
+ "x-enumDescription": enumDescription,
273
274
  properties,
274
275
  items,
275
276
  required,