docusaurus-plugin-openapi-docs 0.0.0-582 → 0.0.0-584
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.
- package/lib/markdown/createRequestSchema.js +20 -7
- package/lib/markdown/createResponseSchema.js +21 -8
- package/lib/markdown/utils.js +1 -1
- package/package.json +2 -2
- package/src/markdown/createRequestSchema.ts +23 -2
- package/src/markdown/createResponseSchema.ts +24 -3
- package/src/markdown/utils.ts +1 -1
|
@@ -30,7 +30,7 @@ function mergeAllOf(allOf) {
|
|
|
30
30
|
return true;
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
|
-
ignoreAdditionalProperties:
|
|
33
|
+
ignoreAdditionalProperties: false,
|
|
34
34
|
});
|
|
35
35
|
const required = allOf.reduce((acc, cur) => {
|
|
36
36
|
if (Array.isArray(cur.required)) {
|
|
@@ -142,12 +142,25 @@ function createAdditionalProperties(schema) {
|
|
|
142
142
|
// },
|
|
143
143
|
// type: 'array'
|
|
144
144
|
// }
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
((
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
const additionalProperties = schema.additionalProperties;
|
|
146
|
+
const type = additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.type;
|
|
147
|
+
if ((type === "object" || type === "array") &&
|
|
148
|
+
((additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.properties) ||
|
|
149
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.items) ||
|
|
150
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.allOf) ||
|
|
151
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.additionalProperties) ||
|
|
152
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.oneOf) ||
|
|
153
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.anyOf))) {
|
|
154
|
+
const title = additionalProperties.title;
|
|
155
|
+
const schemaName = title ? `object (${title})` : "object";
|
|
156
|
+
const required = (_a = schema.required) !== null && _a !== void 0 ? _a : false;
|
|
157
|
+
return createDetailsNode("property name*", schemaName, additionalProperties, required, schema.nullable);
|
|
158
|
+
}
|
|
159
|
+
if (((_b = schema.additionalProperties) === null || _b === void 0 ? void 0 : _b.type) === "string" ||
|
|
160
|
+
((_c = schema.additionalProperties) === null || _c === void 0 ? void 0 : _c.type) === "object" ||
|
|
161
|
+
((_d = schema.additionalProperties) === null || _d === void 0 ? void 0 : _d.type) === "boolean" ||
|
|
162
|
+
((_e = schema.additionalProperties) === null || _e === void 0 ? void 0 : _e.type) === "integer" ||
|
|
163
|
+
((_f = schema.additionalProperties) === null || _f === void 0 ? void 0 : _f.type) === "number") {
|
|
151
164
|
const additionalProperties = (_g = schema.additionalProperties) === null || _g === void 0 ? void 0 : _g.additionalProperties;
|
|
152
165
|
if (additionalProperties !== undefined) {
|
|
153
166
|
const type = (_j = (_h = schema.additionalProperties) === null || _h === void 0 ? void 0 : _h.additionalProperties) === null || _j === void 0 ? void 0 : _j.type;
|
|
@@ -143,12 +143,25 @@ function createAdditionalProperties(schema) {
|
|
|
143
143
|
// },
|
|
144
144
|
// type: 'array'
|
|
145
145
|
// }
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
((
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
const additionalProperties = schema.additionalProperties;
|
|
147
|
+
const type = additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.type;
|
|
148
|
+
if ((type === "object" || type === "array") &&
|
|
149
|
+
((additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.properties) ||
|
|
150
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.items) ||
|
|
151
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.allOf) ||
|
|
152
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.additionalProperties) ||
|
|
153
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.oneOf) ||
|
|
154
|
+
(additionalProperties === null || additionalProperties === void 0 ? void 0 : additionalProperties.anyOf))) {
|
|
155
|
+
const title = additionalProperties.title;
|
|
156
|
+
const schemaName = title ? `object (${title})` : "object";
|
|
157
|
+
const required = (_a = schema.required) !== null && _a !== void 0 ? _a : false;
|
|
158
|
+
return createDetailsNode("property name*", schemaName, additionalProperties, required, schema.nullable);
|
|
159
|
+
}
|
|
160
|
+
if (((_b = schema.additionalProperties) === null || _b === void 0 ? void 0 : _b.type) === "string" ||
|
|
161
|
+
((_c = schema.additionalProperties) === null || _c === void 0 ? void 0 : _c.type) === "object" ||
|
|
162
|
+
((_d = schema.additionalProperties) === null || _d === void 0 ? void 0 : _d.type) === "boolean" ||
|
|
163
|
+
((_e = schema.additionalProperties) === null || _e === void 0 ? void 0 : _e.type) === "integer" ||
|
|
164
|
+
((_f = schema.additionalProperties) === null || _f === void 0 ? void 0 : _f.type) === "number") {
|
|
152
165
|
const additionalProperties = (_g = schema.additionalProperties) === null || _g === void 0 ? void 0 : _g.additionalProperties;
|
|
153
166
|
if (additionalProperties !== undefined) {
|
|
154
167
|
const type = (_j = (_h = schema.additionalProperties) === null || _h === void 0 ? void 0 : _h.additionalProperties) === null || _j === void 0 ? void 0 : _j.type;
|
|
@@ -525,7 +538,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
525
538
|
return (0, utils_1.create)("SchemaItem", {
|
|
526
539
|
collapsible: false,
|
|
527
540
|
name,
|
|
528
|
-
required:
|
|
541
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
529
542
|
schemaName: schemaName,
|
|
530
543
|
qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
|
|
531
544
|
schema: mergedSchemas,
|
|
@@ -551,7 +564,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
551
564
|
return (0, utils_1.create)("SchemaItem", {
|
|
552
565
|
collapsible: false,
|
|
553
566
|
name,
|
|
554
|
-
required:
|
|
567
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
555
568
|
schemaName: schemaName,
|
|
556
569
|
qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
|
|
557
570
|
schema: schema,
|
package/lib/markdown/utils.js
CHANGED
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-
|
|
4
|
+
"version": "0.0.0-584",
|
|
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": "
|
|
71
|
+
"gitHead": "84882bdd00af301f94e88d449b2bcd3fb447308c"
|
|
72
72
|
}
|
|
@@ -34,7 +34,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
|
|
|
34
34
|
return true;
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
ignoreAdditionalProperties:
|
|
37
|
+
ignoreAdditionalProperties: false,
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const required = allOf.reduce((acc, cur) => {
|
|
@@ -157,6 +157,28 @@ function createAdditionalProperties(schema: SchemaObject) {
|
|
|
157
157
|
// },
|
|
158
158
|
// type: 'array'
|
|
159
159
|
// }
|
|
160
|
+
const additionalProperties = schema.additionalProperties;
|
|
161
|
+
const type: string | unknown = additionalProperties?.type;
|
|
162
|
+
if (
|
|
163
|
+
(type === "object" || type === "array") &&
|
|
164
|
+
(additionalProperties?.properties ||
|
|
165
|
+
additionalProperties?.items ||
|
|
166
|
+
additionalProperties?.allOf ||
|
|
167
|
+
additionalProperties?.additionalProperties ||
|
|
168
|
+
additionalProperties?.oneOf ||
|
|
169
|
+
additionalProperties?.anyOf)
|
|
170
|
+
) {
|
|
171
|
+
const title = additionalProperties.title;
|
|
172
|
+
const schemaName = title ? `object (${title})` : "object";
|
|
173
|
+
const required = schema.required ?? false;
|
|
174
|
+
return createDetailsNode(
|
|
175
|
+
"property name*",
|
|
176
|
+
schemaName,
|
|
177
|
+
additionalProperties,
|
|
178
|
+
required,
|
|
179
|
+
schema.nullable
|
|
180
|
+
);
|
|
181
|
+
}
|
|
160
182
|
|
|
161
183
|
if (
|
|
162
184
|
(schema.additionalProperties?.type as string) === "string" ||
|
|
@@ -165,7 +187,6 @@ function createAdditionalProperties(schema: SchemaObject) {
|
|
|
165
187
|
(schema.additionalProperties?.type as string) === "integer" ||
|
|
166
188
|
(schema.additionalProperties?.type as string) === "number"
|
|
167
189
|
) {
|
|
168
|
-
const type = schema.additionalProperties?.type;
|
|
169
190
|
const additionalProperties =
|
|
170
191
|
schema.additionalProperties?.additionalProperties;
|
|
171
192
|
if (additionalProperties !== undefined) {
|
|
@@ -163,6 +163,28 @@ function createAdditionalProperties(schema: SchemaObject) {
|
|
|
163
163
|
// },
|
|
164
164
|
// type: 'array'
|
|
165
165
|
// }
|
|
166
|
+
const additionalProperties = schema.additionalProperties;
|
|
167
|
+
const type: string | unknown = additionalProperties?.type;
|
|
168
|
+
if (
|
|
169
|
+
(type === "object" || type === "array") &&
|
|
170
|
+
(additionalProperties?.properties ||
|
|
171
|
+
additionalProperties?.items ||
|
|
172
|
+
additionalProperties?.allOf ||
|
|
173
|
+
additionalProperties?.additionalProperties ||
|
|
174
|
+
additionalProperties?.oneOf ||
|
|
175
|
+
additionalProperties?.anyOf)
|
|
176
|
+
) {
|
|
177
|
+
const title = additionalProperties.title;
|
|
178
|
+
const schemaName = title ? `object (${title})` : "object";
|
|
179
|
+
const required = schema.required ?? false;
|
|
180
|
+
return createDetailsNode(
|
|
181
|
+
"property name*",
|
|
182
|
+
schemaName,
|
|
183
|
+
additionalProperties,
|
|
184
|
+
required,
|
|
185
|
+
schema.nullable
|
|
186
|
+
);
|
|
187
|
+
}
|
|
166
188
|
|
|
167
189
|
if (
|
|
168
190
|
(schema.additionalProperties?.type as string) === "string" ||
|
|
@@ -171,7 +193,6 @@ function createAdditionalProperties(schema: SchemaObject) {
|
|
|
171
193
|
(schema.additionalProperties?.type as string) === "integer" ||
|
|
172
194
|
(schema.additionalProperties?.type as string) === "number"
|
|
173
195
|
) {
|
|
174
|
-
const type = schema.additionalProperties?.type;
|
|
175
196
|
const additionalProperties =
|
|
176
197
|
schema.additionalProperties?.additionalProperties;
|
|
177
198
|
if (additionalProperties !== undefined) {
|
|
@@ -683,7 +704,7 @@ function createEdges({
|
|
|
683
704
|
return create("SchemaItem", {
|
|
684
705
|
collapsible: false,
|
|
685
706
|
name,
|
|
686
|
-
required:
|
|
707
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
687
708
|
schemaName: schemaName,
|
|
688
709
|
qualifierMessage: getQualifierMessage(schema),
|
|
689
710
|
schema: mergedSchemas,
|
|
@@ -739,7 +760,7 @@ function createEdges({
|
|
|
739
760
|
return create("SchemaItem", {
|
|
740
761
|
collapsible: false,
|
|
741
762
|
name,
|
|
742
|
-
required:
|
|
763
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
743
764
|
schemaName: schemaName,
|
|
744
765
|
qualifierMessage: getQualifierMessage(schema),
|
|
745
766
|
schema: schema,
|