docusaurus-theme-openapi-docs 5.1.2 → 5.1.3

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.
@@ -254,6 +254,7 @@ const AnyOneOf = ({ schema, schemaType, schemaPath }) => {
254
254
  }),
255
255
  anyOneSchema.type === "object" &&
256
256
  !anyOneSchema.properties &&
257
+ !anyOneSchema.additionalProperties &&
257
258
  !anyOneSchema.allOf &&
258
259
  !anyOneSchema.oneOf &&
259
260
  !anyOneSchema.anyOf &&
@@ -275,6 +276,15 @@ const AnyOneOf = ({ schema, schemaType, schemaPath }) => {
275
276
  schemaType: schemaType,
276
277
  schemaPath: childSchemaPath,
277
278
  }),
279
+ (anyOneSchema.type === "object" || !anyOneSchema.type) &&
280
+ anyOneSchema.additionalProperties &&
281
+ !anyOneSchema.oneOf &&
282
+ !anyOneSchema.anyOf &&
283
+ !anyOneSchema.allOf &&
284
+ react_1.default.createElement(AdditionalProperties, {
285
+ schema: anyOneSchema,
286
+ schemaType: schemaType,
287
+ }),
278
288
  anyOneSchema.allOf &&
279
289
  react_1.default.createElement(SchemaNode, {
280
290
  schema: anyOneSchema,
@@ -999,7 +1009,11 @@ const SchemaNode = ({ schema: rawSchema, schemaType, schemaPath }) => {
999
1009
  workingSchema = (0, normalize_1.mergeAllOf)(schema);
1000
1010
  }
1001
1011
  if (!workingSchema.discriminator && resolvedDiscriminator) {
1002
- workingSchema.discriminator = resolvedDiscriminator;
1012
+ // Clone: getDiscriminator returns a nested branch's discriminator by
1013
+ // reference, and DiscriminatorNode mutates `.mapping` when inferring
1014
+ // variants. Without cloning, a branch that declares its own discriminator
1015
+ // gets a mapping pointing back to itself and recurses forever.
1016
+ workingSchema.discriminator = { ...resolvedDiscriminator };
1003
1017
  }
1004
1018
  if (workingSchema.discriminator) {
1005
1019
  const { discriminator } = workingSchema;
@@ -164,7 +164,7 @@ function parseCodeLinesFromContent(code, params) {
164
164
  .filter((d) => d.block)
165
165
  .map(({ className, block }) => [block.end, className])
166
166
  );
167
- for (let lineNumber = 0; lineNumber < lines.length; ) {
167
+ for (let lineNumber = 0; lineNumber < lines.length;) {
168
168
  const line = lines[lineNumber];
169
169
  const match = line.match(directiveRegex);
170
170
  if (!match) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "5.1.2",
4
+ "version": "5.1.3",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -38,7 +38,7 @@
38
38
  "@types/postman-collection": "^3.5.11",
39
39
  "@types/react-modal": "^3.16.3",
40
40
  "concurrently": "^10.0.3",
41
- "docusaurus-plugin-openapi-docs": "^5.1.2",
41
+ "docusaurus-plugin-openapi-docs": "^5.1.3",
42
42
  "docusaurus-plugin-sass": "^0.2.6",
43
43
  "eslint-plugin-prettier": "^5.5.1"
44
44
  },
@@ -52,7 +52,7 @@
52
52
  "crypto-js": "^4.2.0",
53
53
  "file-saver": "^2.0.5",
54
54
  "lodash": "^4.17.21",
55
- "pako": "^2.1.0",
55
+ "pako": "^3.0.1",
56
56
  "path-browserify": "^1.0.1",
57
57
  "postman-code-generators": "^2.0.0",
58
58
  "postman-collection": "^5.0.2",
@@ -67,7 +67,7 @@
67
67
  "rehype-raw": "^7.0.0",
68
68
  "remark-gfm": "4.0.1",
69
69
  "sass": "^1.89.2",
70
- "sass-loader": "^16.0.5",
70
+ "sass-loader": "^17.0.0",
71
71
  "unist-util-visit": "^5.0.0",
72
72
  "url": "^0.11.4",
73
73
  "xml-formatter": "^3.6.6"
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=14"
84
84
  },
85
- "gitHead": "c5e36feabeb4ee6758a7bf5a24a7bfe96cb88500"
85
+ "gitHead": "d5af4f22e951712e084df8b7c513a1708e56d372"
86
86
  }
@@ -236,6 +236,7 @@ const AnyOneOf: React.FC<SchemaProps> = ({
236
236
  {/* Handle empty object as a primitive type */}
237
237
  {anyOneSchema.type === "object" &&
238
238
  !anyOneSchema.properties &&
239
+ !anyOneSchema.additionalProperties &&
239
240
  !anyOneSchema.allOf &&
240
241
  !anyOneSchema.oneOf &&
241
242
  !anyOneSchema.anyOf && (
@@ -267,6 +268,17 @@ const AnyOneOf: React.FC<SchemaProps> = ({
267
268
  schemaPath={childSchemaPath}
268
269
  />
269
270
  )}
271
+ {/* Render a map variant's `additionalProperties` */}
272
+ {(anyOneSchema.type === "object" || !anyOneSchema.type) &&
273
+ anyOneSchema.additionalProperties &&
274
+ !anyOneSchema.oneOf &&
275
+ !anyOneSchema.anyOf &&
276
+ !anyOneSchema.allOf && (
277
+ <AdditionalProperties
278
+ schema={anyOneSchema}
279
+ schemaType={schemaType}
280
+ />
281
+ )}
270
282
  {anyOneSchema.allOf && (
271
283
  <SchemaNode
272
284
  schema={anyOneSchema}
@@ -1108,7 +1120,11 @@ const SchemaNode: React.FC<SchemaProps> = ({
1108
1120
  workingSchema = mergeAllOf(schema) as SchemaObject;
1109
1121
  }
1110
1122
  if (!workingSchema.discriminator && resolvedDiscriminator) {
1111
- workingSchema.discriminator = resolvedDiscriminator;
1123
+ // Clone: getDiscriminator returns a nested branch's discriminator by
1124
+ // reference, and DiscriminatorNode mutates `.mapping` when inferring
1125
+ // variants. Without cloning, a branch that declares its own discriminator
1126
+ // gets a mapping pointing back to itself and recurses forever.
1127
+ workingSchema.discriminator = { ...resolvedDiscriminator };
1112
1128
  }
1113
1129
 
1114
1130
  if (workingSchema.discriminator) {
@@ -1265,8 +1281,7 @@ const SchemaNode: React.FC<SchemaProps> = ({
1265
1281
  export default SchemaNode;
1266
1282
 
1267
1283
  type PrimitiveSchemaType =
1268
- | Exclude<NonNullable<SchemaObject["type"]>, "object" | "array">
1269
- | "null";
1284
+ Exclude<NonNullable<SchemaObject["type"]>, "object" | "array"> | "null";
1270
1285
 
1271
1286
  const PRIMITIVE_TYPES: Record<PrimitiveSchemaType, true> = {
1272
1287
  string: true,