docusaurus-plugin-openapi-docs 2.1.2 → 2.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.
|
@@ -4,7 +4,7 @@ import { SchemaObject } from "../openapi/types";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function mergeAllOf(allOf: SchemaObject[]): {
|
|
6
6
|
mergedSchemas: any;
|
|
7
|
-
|
|
7
|
+
mergedRequired: any;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Creates a hierarchical level of a schema tree. Nodes produce edges that can branch into sub-nodes with edges, recursively.
|
|
@@ -40,14 +40,14 @@ function mergeAllOf(allOf) {
|
|
|
40
40
|
},
|
|
41
41
|
ignoreAdditionalProperties: true,
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const mergedRequired = allOf.reduce((acc, cur) => {
|
|
44
44
|
if (Array.isArray(cur.required)) {
|
|
45
45
|
const next = [...acc, ...cur.required];
|
|
46
46
|
return next;
|
|
47
47
|
}
|
|
48
48
|
return acc;
|
|
49
49
|
}, []);
|
|
50
|
-
return { mergedSchemas,
|
|
50
|
+
return { mergedSchemas, mergedRequired };
|
|
51
51
|
}
|
|
52
52
|
exports.mergeAllOf = mergeAllOf;
|
|
53
53
|
/**
|
|
@@ -491,7 +491,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
491
491
|
return createAnyOneOfProperty(name, schemaName, schema, required, schema.nullable);
|
|
492
492
|
}
|
|
493
493
|
if (schema.allOf !== undefined) {
|
|
494
|
-
const { mergedSchemas
|
|
494
|
+
const { mergedSchemas } = mergeAllOf(schema.allOf);
|
|
495
495
|
const mergedSchemaName = (0, schema_1.getSchemaName)(mergedSchemas);
|
|
496
496
|
if (mergedSchemas.oneOf !== undefined ||
|
|
497
497
|
mergedSchemas.anyOf !== 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": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
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": "
|
|
63
|
+
"gitHead": "3bca23ffd3bc51c3d7f4ebb3916e2ece8c823961"
|
|
64
64
|
}
|
|
@@ -44,7 +44,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
|
|
|
44
44
|
ignoreAdditionalProperties: true,
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
const
|
|
47
|
+
const mergedRequired = allOf.reduce((acc, cur) => {
|
|
48
48
|
if (Array.isArray(cur.required)) {
|
|
49
49
|
const next = [...acc, ...cur.required];
|
|
50
50
|
return next;
|
|
@@ -52,7 +52,7 @@ export function mergeAllOf(allOf: SchemaObject[]) {
|
|
|
52
52
|
return acc;
|
|
53
53
|
}, [] as any);
|
|
54
54
|
|
|
55
|
-
return { mergedSchemas,
|
|
55
|
+
return { mergedSchemas, mergedRequired };
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -260,9 +260,8 @@ function createItems(schema: SchemaObject) {
|
|
|
260
260
|
// TODO: figure out if and how we should pass merged required array
|
|
261
261
|
const {
|
|
262
262
|
mergedSchemas,
|
|
263
|
-
}: { mergedSchemas: SchemaObject;
|
|
264
|
-
schema.items?.allOf
|
|
265
|
-
);
|
|
263
|
+
}: { mergedSchemas: SchemaObject; mergedRequired: string[] | boolean } =
|
|
264
|
+
mergeAllOf(schema.items?.allOf);
|
|
266
265
|
|
|
267
266
|
// Handles combo anyOf/oneOf + properties
|
|
268
267
|
if (
|
|
@@ -596,7 +595,6 @@ function createEdges({
|
|
|
596
595
|
discriminator,
|
|
597
596
|
}: EdgeProps): any {
|
|
598
597
|
const schemaName = getSchemaName(schema);
|
|
599
|
-
|
|
600
598
|
if (discriminator !== undefined && discriminator.propertyName === name) {
|
|
601
599
|
return createPropertyDiscriminator(
|
|
602
600
|
name,
|
|
@@ -618,11 +616,9 @@ function createEdges({
|
|
|
618
616
|
}
|
|
619
617
|
|
|
620
618
|
if (schema.allOf !== undefined) {
|
|
621
|
-
const {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}: { mergedSchemas: SchemaObject; required: string[] | boolean } =
|
|
625
|
-
mergeAllOf(schema.allOf);
|
|
619
|
+
const { mergedSchemas }: { mergedSchemas: SchemaObject } = mergeAllOf(
|
|
620
|
+
schema.allOf
|
|
621
|
+
);
|
|
626
622
|
const mergedSchemaName = getSchemaName(mergedSchemas);
|
|
627
623
|
if (
|
|
628
624
|
mergedSchemas.oneOf !== undefined ||
|