docusaurus-plugin-openapi-docs 0.0.0-beta.653 → 0.0.0-beta.655

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.
@@ -47,7 +47,7 @@ exports.mergeAllOf = mergeAllOf;
47
47
  */
48
48
  function createAnyOneOf(schema) {
49
49
  const type = schema.oneOf ? "oneOf" : "anyOf";
50
- return (0, utils_1.create)("li", {
50
+ return (0, utils_1.create)("div", {
51
51
  children: [
52
52
  (0, utils_1.create)("span", {
53
53
  className: "badge badge--info",
@@ -61,12 +61,15 @@ function createAnyOneOf(schema) {
61
61
  const anyOneChildren = [];
62
62
  if (anyOneSchema.properties !== undefined) {
63
63
  anyOneChildren.push(createProperties(anyOneSchema));
64
+ delete anyOneSchema.properties;
64
65
  }
65
66
  if (anyOneSchema.allOf !== undefined) {
66
67
  anyOneChildren.push(createNodes(anyOneSchema));
68
+ delete anyOneSchema.allOf;
67
69
  }
68
70
  if (anyOneSchema.items !== undefined) {
69
71
  anyOneChildren.push(createItems(anyOneSchema));
72
+ delete anyOneSchema.items;
70
73
  }
71
74
  if (anyOneSchema.type === "string" ||
72
75
  anyOneSchema.type === "number" ||
@@ -144,6 +147,18 @@ function createAdditionalProperties(schema) {
144
147
  // }
145
148
  const additionalProperties = schema.additionalProperties;
146
149
  const type = additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.type;
150
+ // Handle free-form objects
151
+ if (String(additionalProperties) === "true" && schema.type === "object") {
152
+ return (0, utils_1.create)("SchemaItem", {
153
+ name: "property name*",
154
+ required: false,
155
+ schemaName: "any",
156
+ qualifierMessage: (0, schema_1.getQualifierMessage)(schema.additionalProperties),
157
+ schema: schema,
158
+ collapsible: false,
159
+ discriminator: false,
160
+ });
161
+ }
147
162
  if ((type === "object" || type === "array") &&
148
163
  ((additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.properties) ||
149
164
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.items) ||
@@ -152,9 +167,9 @@ function createAdditionalProperties(schema) {
152
167
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.oneOf) ||
153
168
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.anyOf))) {
154
169
  const title = additionalProperties.title;
155
- const schemaName = title ? `object (${title})` : "object";
170
+ const schemaName = (0, schema_1.getSchemaName)(additionalProperties);
156
171
  const required = (_a = schema.required) !== null && _a !== void 0 ? _a : false;
157
- return createDetailsNode("property name*", schemaName, additionalProperties, required, schema.nullable);
172
+ return createDetailsNode("property name*", title !== null && title !== void 0 ? title : schemaName, additionalProperties, required, schema.nullable);
158
173
  }
159
174
  if (((_b = schema.additionalProperties) === null || _b === void 0 ? void 0 : _b.type) === "string" ||
160
175
  ((_c = schema.additionalProperties) === null || _c === void 0 ? void 0 : _c.type) === "object" ||
@@ -164,41 +179,26 @@ function createAdditionalProperties(schema) {
164
179
  const additionalProperties = (_g = schema.additionalProperties) === null || _g === void 0 ? void 0 : _g.additionalProperties;
165
180
  if (additionalProperties !== undefined) {
166
181
  const type = (_j = (_h = schema.additionalProperties) === null || _h === void 0 ? void 0 : _h.additionalProperties) === null || _j === void 0 ? void 0 : _j.type;
167
- const format = (_l = (_k = schema.additionalProperties) === null || _k === void 0 ? void 0 : _k.additionalProperties) === null || _l === void 0 ? void 0 : _l.format;
168
- return (0, utils_1.create)("li", {
169
- children: (0, utils_1.create)("div", {
170
- children: [
171
- (0, utils_1.create)("code", { children: `property name*` }),
172
- (0, utils_1.guard)(type, (type) => (0, utils_1.create)("span", {
173
- style: { opacity: "0.6" },
174
- children: ` ${type}`,
175
- })),
176
- (0, utils_1.guard)(format, (format) => (0, utils_1.create)("span", {
177
- style: { opacity: "0.6" },
178
- children: ` (${format})`,
179
- })),
180
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema.additionalProperties), (message) => (0, utils_1.create)("div", {
181
- style: { marginTop: "var(--ifm-table-cell-padding)" },
182
- children: (0, createDescription_1.createDescription)(message),
183
- })),
184
- ],
185
- }),
182
+ const schemaName = (0, schema_1.getSchemaName)((_k = schema.additionalProperties) === null || _k === void 0 ? void 0 : _k.additionalProperties);
183
+ return (0, utils_1.create)("SchemaItem", {
184
+ name: "property name*",
185
+ required: false,
186
+ schemaName: schemaName !== null && schemaName !== void 0 ? schemaName : type,
187
+ qualifierMessage: (_l = schema.additionalProperties) !== null && _l !== void 0 ? _l : (0, schema_1.getQualifierMessage)(schema.additionalProperties),
188
+ schema: schema,
189
+ collapsible: false,
190
+ discriminator: false,
186
191
  });
187
192
  }
188
- return (0, utils_1.create)("li", {
189
- children: (0, utils_1.create)("div", {
190
- children: [
191
- (0, utils_1.create)("code", { children: `property name*` }),
192
- (0, utils_1.guard)(type, (type) => (0, utils_1.create)("span", {
193
- style: { opacity: "0.6" },
194
- children: ` ${type}`,
195
- })),
196
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema.additionalProperties), (message) => (0, utils_1.create)("div", {
197
- style: { marginTop: "var(--ifm-table-cell-padding)" },
198
- children: (0, createDescription_1.createDescription)(message),
199
- })),
200
- ],
201
- }),
193
+ const schemaName = (0, schema_1.getSchemaName)(schema.additionalProperties);
194
+ return (0, utils_1.create)("SchemaItem", {
195
+ name: "property name*",
196
+ required: false,
197
+ schemaName: schemaName,
198
+ qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
199
+ schema: schema.additionalProperties,
200
+ collapsible: false,
201
+ discriminator: false,
202
202
  });
203
203
  }
204
204
  return Object.entries(schema.additionalProperties).map(([key, val]) => createEdges({
@@ -48,14 +48,13 @@ exports.mergeAllOf = mergeAllOf;
48
48
  */
49
49
  function createAnyOneOf(schema) {
50
50
  const type = schema.oneOf ? "oneOf" : "anyOf";
51
- return (0, utils_1.create)("li", {
51
+ return (0, utils_1.create)("div", {
52
52
  children: [
53
53
  (0, utils_1.create)("span", {
54
54
  className: "badge badge--info",
55
55
  children: type,
56
56
  }),
57
57
  (0, utils_1.create)("SchemaTabs", {
58
- className: "openapi-tabs__schema",
59
58
  children: schema[type].map((anyOneSchema, index) => {
60
59
  const label = anyOneSchema.title
61
60
  ? anyOneSchema.title
@@ -63,12 +62,15 @@ function createAnyOneOf(schema) {
63
62
  const anyOneChildren = [];
64
63
  if (anyOneSchema.properties !== undefined) {
65
64
  anyOneChildren.push(createProperties(anyOneSchema));
65
+ delete anyOneSchema.properties;
66
66
  }
67
67
  if (anyOneSchema.allOf !== undefined) {
68
68
  anyOneChildren.push(createNodes(anyOneSchema));
69
+ delete anyOneSchema.allOf;
69
70
  }
70
71
  if (anyOneSchema.items !== undefined) {
71
72
  anyOneChildren.push(createItems(anyOneSchema));
73
+ delete anyOneSchema.items;
72
74
  }
73
75
  if (anyOneSchema.type === "string" ||
74
76
  anyOneSchema.type === "number" ||
@@ -93,7 +95,7 @@ function createAnyOneOf(schema) {
93
95
  return (0, utils_1.create)("TabItem", {
94
96
  label: label,
95
97
  value: `${index}-item-properties`,
96
- children: anyOneChildren,
98
+ children: anyOneChildren.filter(Boolean).flat(),
97
99
  });
98
100
  }
99
101
  return undefined;
@@ -146,6 +148,18 @@ function createAdditionalProperties(schema) {
146
148
  // }
147
149
  const additionalProperties = schema.additionalProperties;
148
150
  const type = additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.type;
151
+ // Handle free-form objects
152
+ if (String(additionalProperties) === "true" && schema.type === "object") {
153
+ return (0, utils_1.create)("SchemaItem", {
154
+ name: "property name*",
155
+ required: false,
156
+ schemaName: "any",
157
+ qualifierMessage: (0, schema_1.getQualifierMessage)(schema.additionalProperties),
158
+ schema: schema,
159
+ collapsible: false,
160
+ discriminator: false,
161
+ });
162
+ }
149
163
  if ((type === "object" || type === "array") &&
150
164
  ((additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.properties) ||
151
165
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.items) ||
@@ -154,9 +168,9 @@ function createAdditionalProperties(schema) {
154
168
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.oneOf) ||
155
169
  (additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.anyOf))) {
156
170
  const title = additionalProperties.title;
157
- const schemaName = title ? `object (${title})` : "object";
171
+ const schemaName = (0, schema_1.getSchemaName)(additionalProperties);
158
172
  const required = (_a = schema.required) !== null && _a !== void 0 ? _a : false;
159
- return createDetailsNode("property name*", schemaName, additionalProperties, required, schema.nullable);
173
+ return createDetailsNode("property name*", title !== null && title !== void 0 ? title : schemaName, additionalProperties, required, schema.nullable);
160
174
  }
161
175
  if (((_b = schema.additionalProperties) === null || _b === void 0 ? void 0 : _b.type) === "string" ||
162
176
  ((_c = schema.additionalProperties) === null || _c === void 0 ? void 0 : _c.type) === "object" ||
@@ -166,41 +180,26 @@ function createAdditionalProperties(schema) {
166
180
  const additionalProperties = (_g = schema.additionalProperties) === null || _g === void 0 ? void 0 : _g.additionalProperties;
167
181
  if (additionalProperties !== undefined) {
168
182
  const type = (_j = (_h = schema.additionalProperties) === null || _h === void 0 ? void 0 : _h.additionalProperties) === null || _j === void 0 ? void 0 : _j.type;
169
- const format = (_l = (_k = schema.additionalProperties) === null || _k === void 0 ? void 0 : _k.additionalProperties) === null || _l === void 0 ? void 0 : _l.format;
170
- return (0, utils_1.create)("li", {
171
- children: (0, utils_1.create)("div", {
172
- children: [
173
- (0, utils_1.create)("code", { children: `property name*` }),
174
- (0, utils_1.guard)(type, (type) => (0, utils_1.create)("span", {
175
- style: { opacity: "0.6" },
176
- children: ` ${type}`,
177
- })),
178
- (0, utils_1.guard)(format, (format) => (0, utils_1.create)("span", {
179
- style: { opacity: "0.6" },
180
- children: ` (${format})`,
181
- })),
182
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema.additionalProperties), (message) => (0, utils_1.create)("div", {
183
- style: { marginTop: "var(--ifm-table-cell-padding)" },
184
- children: (0, createDescription_1.createDescription)(message),
185
- })),
186
- ],
187
- }),
183
+ const schemaName = (0, schema_1.getSchemaName)((_k = schema.additionalProperties) === null || _k === void 0 ? void 0 : _k.additionalProperties);
184
+ return (0, utils_1.create)("SchemaItem", {
185
+ name: "property name*",
186
+ required: false,
187
+ schemaName: schemaName !== null && schemaName !== void 0 ? schemaName : type,
188
+ qualifierMessage: (_l = schema.additionalProperties) !== null && _l !== void 0 ? _l : (0, schema_1.getQualifierMessage)(schema.additionalProperties),
189
+ schema: schema,
190
+ collapsible: false,
191
+ discriminator: false,
188
192
  });
189
193
  }
190
- return (0, utils_1.create)("li", {
191
- children: (0, utils_1.create)("div", {
192
- children: [
193
- (0, utils_1.create)("code", { children: `property name*` }),
194
- (0, utils_1.guard)(type, (type) => (0, utils_1.create)("span", {
195
- style: { opacity: "0.6" },
196
- children: ` ${type}`,
197
- })),
198
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema.additionalProperties), (message) => (0, utils_1.create)("div", {
199
- style: { marginTop: "var(--ifm-table-cell-padding)" },
200
- children: (0, createDescription_1.createDescription)(message),
201
- })),
202
- ],
203
- }),
194
+ const schemaName = (0, schema_1.getSchemaName)(schema.additionalProperties);
195
+ return (0, utils_1.create)("SchemaItem", {
196
+ name: "property name*",
197
+ required: false,
198
+ schemaName: schemaName,
199
+ qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
200
+ schema: schema.additionalProperties,
201
+ collapsible: false,
202
+ discriminator: false,
204
203
  });
205
204
  }
206
205
  return Object.entries(schema.additionalProperties).map(([key, val]) => createEdges({
@@ -74,7 +74,6 @@ function convertSwagger2OpenAPI(spec) {
74
74
  }
75
75
  exports.convertSwagger2OpenAPI = convertSwagger2OpenAPI;
76
76
  async function resolveJsonRefs(specUrlOrObject) {
77
- var _a, _b;
78
77
  try {
79
78
  let schema = await json_schema_ref_parser_1.default.dereference(specUrlOrObject, {
80
79
  continueOnError: true,
@@ -92,7 +91,15 @@ async function resolveJsonRefs(specUrlOrObject) {
92
91
  return schema;
93
92
  }
94
93
  catch (err) {
95
- console.error(chalk_1.default.yellow((_b = (_a = err.errors[0]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : err));
94
+ let errorMsg = "";
95
+ if (err.errors[0] !== undefined) {
96
+ const error = err.errors[0];
97
+ errorMsg = `Error: [${error.message}] with footprint [${error.footprint}]`;
98
+ }
99
+ else {
100
+ errorMsg = err;
101
+ }
102
+ console.error(chalk_1.default.yellow(errorMsg));
96
103
  return;
97
104
  }
98
105
  }
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-beta.653",
4
+ "version": "0.0.0-beta.655",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14"
62
62
  },
63
- "gitHead": "b7e8dbcc5df6c871cc240eb0407335fb2e973d7a"
63
+ "gitHead": "491fc2c4826e5461c4a90752b999d3dd28fba828"
64
64
  }
@@ -53,7 +53,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
53
53
  */
54
54
  function createAnyOneOf(schema: SchemaObject): any {
55
55
  const type = schema.oneOf ? "oneOf" : "anyOf";
56
- return create("li", {
56
+ return create("div", {
57
57
  children: [
58
58
  create("span", {
59
59
  className: "badge badge--info",
@@ -68,14 +68,17 @@ function createAnyOneOf(schema: SchemaObject): any {
68
68
 
69
69
  if (anyOneSchema.properties !== undefined) {
70
70
  anyOneChildren.push(createProperties(anyOneSchema));
71
+ delete anyOneSchema.properties;
71
72
  }
72
73
 
73
74
  if (anyOneSchema.allOf !== undefined) {
74
75
  anyOneChildren.push(createNodes(anyOneSchema));
76
+ delete anyOneSchema.allOf;
75
77
  }
76
78
 
77
79
  if (anyOneSchema.items !== undefined) {
78
80
  anyOneChildren.push(createItems(anyOneSchema));
81
+ delete anyOneSchema.items;
79
82
  }
80
83
 
81
84
  if (
@@ -159,6 +162,18 @@ function createAdditionalProperties(schema: SchemaObject) {
159
162
  // }
160
163
  const additionalProperties = schema.additionalProperties;
161
164
  const type: string | unknown = additionalProperties?.type;
165
+ // Handle free-form objects
166
+ if (String(additionalProperties) === "true" && schema.type === "object") {
167
+ return create("SchemaItem", {
168
+ name: "property name*",
169
+ required: false,
170
+ schemaName: "any",
171
+ qualifierMessage: getQualifierMessage(schema.additionalProperties),
172
+ schema: schema,
173
+ collapsible: false,
174
+ discriminator: false,
175
+ });
176
+ }
162
177
  if (
163
178
  (type === "object" || type === "array") &&
164
179
  (additionalProperties?.properties ||
@@ -168,12 +183,12 @@ function createAdditionalProperties(schema: SchemaObject) {
168
183
  additionalProperties?.oneOf ||
169
184
  additionalProperties?.anyOf)
170
185
  ) {
171
- const title = additionalProperties.title;
172
- const schemaName = title ? `object (${title})` : "object";
186
+ const title = additionalProperties.title as string;
187
+ const schemaName = getSchemaName(additionalProperties);
173
188
  const required = schema.required ?? false;
174
189
  return createDetailsNode(
175
190
  "property name*",
176
- schemaName,
191
+ title ?? schemaName,
177
192
  additionalProperties,
178
193
  required,
179
194
  schema.nullable
@@ -191,51 +206,30 @@ function createAdditionalProperties(schema: SchemaObject) {
191
206
  schema.additionalProperties?.additionalProperties;
192
207
  if (additionalProperties !== undefined) {
193
208
  const type = schema.additionalProperties?.additionalProperties?.type;
194
- const format = schema.additionalProperties?.additionalProperties?.format;
195
- return create("li", {
196
- children: create("div", {
197
- children: [
198
- create("code", { children: `property name*` }),
199
- guard(type, (type) =>
200
- create("span", {
201
- style: { opacity: "0.6" },
202
- children: ` ${type}`,
203
- })
204
- ),
205
- guard(format, (format) =>
206
- create("span", {
207
- style: { opacity: "0.6" },
208
- children: ` (${format})`,
209
- })
210
- ),
211
- guard(getQualifierMessage(schema.additionalProperties), (message) =>
212
- create("div", {
213
- style: { marginTop: "var(--ifm-table-cell-padding)" },
214
- children: createDescription(message),
215
- })
216
- ),
217
- ],
218
- }),
209
+ const schemaName = getSchemaName(
210
+ schema.additionalProperties?.additionalProperties!
211
+ );
212
+ return create("SchemaItem", {
213
+ name: "property name*",
214
+ required: false,
215
+ schemaName: schemaName ?? type,
216
+ qualifierMessage:
217
+ schema.additionalProperties ??
218
+ getQualifierMessage(schema.additionalProperties),
219
+ schema: schema,
220
+ collapsible: false,
221
+ discriminator: false,
219
222
  });
220
223
  }
221
- return create("li", {
222
- children: create("div", {
223
- children: [
224
- create("code", { children: `property name*` }),
225
- guard(type, (type) =>
226
- create("span", {
227
- style: { opacity: "0.6" },
228
- children: ` ${type}`,
229
- })
230
- ),
231
- guard(getQualifierMessage(schema.additionalProperties), (message) =>
232
- create("div", {
233
- style: { marginTop: "var(--ifm-table-cell-padding)" },
234
- children: createDescription(message),
235
- })
236
- ),
237
- ],
238
- }),
224
+ const schemaName = getSchemaName(schema.additionalProperties!);
225
+ return create("SchemaItem", {
226
+ name: "property name*",
227
+ required: false,
228
+ schemaName: schemaName,
229
+ qualifierMessage: getQualifierMessage(schema),
230
+ schema: schema.additionalProperties,
231
+ collapsible: false,
232
+ discriminator: false,
239
233
  });
240
234
  }
241
235
  return Object.entries(schema.additionalProperties!).map(([key, val]) =>
@@ -58,14 +58,13 @@ export function mergeAllOf(allOf: SchemaObject[]) {
58
58
  */
59
59
  function createAnyOneOf(schema: SchemaObject): any {
60
60
  const type = schema.oneOf ? "oneOf" : "anyOf";
61
- return create("li", {
61
+ return create("div", {
62
62
  children: [
63
63
  create("span", {
64
64
  className: "badge badge--info",
65
65
  children: type,
66
66
  }),
67
67
  create("SchemaTabs", {
68
- className: "openapi-tabs__schema",
69
68
  children: schema[type]!.map((anyOneSchema, index) => {
70
69
  const label = anyOneSchema.title
71
70
  ? anyOneSchema.title
@@ -74,14 +73,17 @@ function createAnyOneOf(schema: SchemaObject): any {
74
73
 
75
74
  if (anyOneSchema.properties !== undefined) {
76
75
  anyOneChildren.push(createProperties(anyOneSchema));
76
+ delete anyOneSchema.properties;
77
77
  }
78
78
 
79
79
  if (anyOneSchema.allOf !== undefined) {
80
80
  anyOneChildren.push(createNodes(anyOneSchema));
81
+ delete anyOneSchema.allOf;
81
82
  }
82
83
 
83
84
  if (anyOneSchema.items !== undefined) {
84
85
  anyOneChildren.push(createItems(anyOneSchema));
86
+ delete anyOneSchema.items;
85
87
  }
86
88
 
87
89
  if (
@@ -92,7 +94,6 @@ function createAnyOneOf(schema: SchemaObject): any {
92
94
  ) {
93
95
  anyOneChildren.push(createNodes(anyOneSchema));
94
96
  }
95
-
96
97
  if (anyOneChildren.length) {
97
98
  if (schema.type === "array") {
98
99
  return create("TabItem", {
@@ -110,7 +111,7 @@ function createAnyOneOf(schema: SchemaObject): any {
110
111
  return create("TabItem", {
111
112
  label: label,
112
113
  value: `${index}-item-properties`,
113
- children: anyOneChildren,
114
+ children: anyOneChildren.filter(Boolean).flat(),
114
115
  });
115
116
  }
116
117
 
@@ -166,6 +167,18 @@ function createAdditionalProperties(schema: SchemaObject) {
166
167
  // }
167
168
  const additionalProperties = schema.additionalProperties;
168
169
  const type: string | unknown = additionalProperties?.type;
170
+ // Handle free-form objects
171
+ if (String(additionalProperties) === "true" && schema.type === "object") {
172
+ return create("SchemaItem", {
173
+ name: "property name*",
174
+ required: false,
175
+ schemaName: "any",
176
+ qualifierMessage: getQualifierMessage(schema.additionalProperties),
177
+ schema: schema,
178
+ collapsible: false,
179
+ discriminator: false,
180
+ });
181
+ }
169
182
  if (
170
183
  (type === "object" || type === "array") &&
171
184
  (additionalProperties?.properties ||
@@ -175,12 +188,12 @@ function createAdditionalProperties(schema: SchemaObject) {
175
188
  additionalProperties?.oneOf ||
176
189
  additionalProperties?.anyOf)
177
190
  ) {
178
- const title = additionalProperties.title;
179
- const schemaName = title ? `object (${title})` : "object";
191
+ const title = additionalProperties.title as string;
192
+ const schemaName = getSchemaName(additionalProperties);
180
193
  const required = schema.required ?? false;
181
194
  return createDetailsNode(
182
195
  "property name*",
183
- schemaName,
196
+ title ?? schemaName,
184
197
  additionalProperties,
185
198
  required,
186
199
  schema.nullable
@@ -198,51 +211,30 @@ function createAdditionalProperties(schema: SchemaObject) {
198
211
  schema.additionalProperties?.additionalProperties;
199
212
  if (additionalProperties !== undefined) {
200
213
  const type = schema.additionalProperties?.additionalProperties?.type;
201
- const format = schema.additionalProperties?.additionalProperties?.format;
202
- return create("li", {
203
- children: create("div", {
204
- children: [
205
- create("code", { children: `property name*` }),
206
- guard(type, (type) =>
207
- create("span", {
208
- style: { opacity: "0.6" },
209
- children: ` ${type}`,
210
- })
211
- ),
212
- guard(format, (format) =>
213
- create("span", {
214
- style: { opacity: "0.6" },
215
- children: ` (${format})`,
216
- })
217
- ),
218
- guard(getQualifierMessage(schema.additionalProperties), (message) =>
219
- create("div", {
220
- style: { marginTop: "var(--ifm-table-cell-padding)" },
221
- children: createDescription(message),
222
- })
223
- ),
224
- ],
225
- }),
214
+ const schemaName = getSchemaName(
215
+ schema.additionalProperties?.additionalProperties!
216
+ );
217
+ return create("SchemaItem", {
218
+ name: "property name*",
219
+ required: false,
220
+ schemaName: schemaName ?? type,
221
+ qualifierMessage:
222
+ schema.additionalProperties ??
223
+ getQualifierMessage(schema.additionalProperties),
224
+ schema: schema,
225
+ collapsible: false,
226
+ discriminator: false,
226
227
  });
227
228
  }
228
- return create("li", {
229
- children: create("div", {
230
- children: [
231
- create("code", { children: `property name*` }),
232
- guard(type, (type) =>
233
- create("span", {
234
- style: { opacity: "0.6" },
235
- children: ` ${type}`,
236
- })
237
- ),
238
- guard(getQualifierMessage(schema.additionalProperties), (message) =>
239
- create("div", {
240
- style: { marginTop: "var(--ifm-table-cell-padding)" },
241
- children: createDescription(message),
242
- })
243
- ),
244
- ],
245
- }),
229
+ const schemaName = getSchemaName(schema.additionalProperties!);
230
+ return create("SchemaItem", {
231
+ name: "property name*",
232
+ required: false,
233
+ schemaName: schemaName,
234
+ qualifierMessage: getQualifierMessage(schema),
235
+ schema: schema.additionalProperties,
236
+ collapsible: false,
237
+ discriminator: false,
246
238
  });
247
239
  }
248
240
  return Object.entries(schema.additionalProperties!).map(([key, val]) =>
@@ -101,7 +101,16 @@ async function resolveJsonRefs(specUrlOrObject: object | string) {
101
101
  });
102
102
  return schema as OpenApiObject;
103
103
  } catch (err: any) {
104
- console.error(chalk.yellow(err.errors[0]?.message ?? err));
104
+ let errorMsg = "";
105
+
106
+ if (err.errors[0] !== undefined) {
107
+ const error = err.errors[0];
108
+ errorMsg = `Error: [${error.message}] with footprint [${error.footprint}]`;
109
+ } else {
110
+ errorMsg = err;
111
+ }
112
+
113
+ console.error(chalk.yellow(errorMsg));
105
114
  return;
106
115
  }
107
116
  }