docusaurus-plugin-openapi-docs 2.1.0 → 2.1.2
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/createSchema.js +20 -6
- package/lib/markdown/schema.js +3 -0
- package/lib/markdown/utils.js +1 -1
- package/lib/sidebars/index.js +1 -1
- package/package.json +4 -4
- package/src/markdown/__snapshots__/createSchema.test.ts.snap +4 -28
- package/src/markdown/createSchema.ts +24 -7
- package/src/markdown/schema.ts +4 -0
- package/src/markdown/utils.ts +1 -1
- package/src/sidebars/index.ts +1 -1
|
@@ -521,8 +521,8 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
521
521
|
collapsible: false,
|
|
522
522
|
name,
|
|
523
523
|
required: Array.isArray(required) ? required.includes(name) : required,
|
|
524
|
-
schemaName:
|
|
525
|
-
qualifierMessage: (0, schema_1.getQualifierMessage)(
|
|
524
|
+
schemaName: mergedSchemaName,
|
|
525
|
+
qualifierMessage: (0, schema_1.getQualifierMessage)(mergedSchemas),
|
|
526
526
|
schema: mergedSchemas,
|
|
527
527
|
});
|
|
528
528
|
}
|
|
@@ -610,9 +610,16 @@ function createNodes(schema, schemaType) {
|
|
|
610
610
|
style: {
|
|
611
611
|
marginTop: ".5rem",
|
|
612
612
|
marginBottom: ".5rem",
|
|
613
|
-
marginLeft: "1rem",
|
|
614
613
|
},
|
|
615
|
-
children:
|
|
614
|
+
children: [
|
|
615
|
+
(0, createDescription_1.createDescription)(schema.type),
|
|
616
|
+
(0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema), (message) => (0, utils_1.create)("div", {
|
|
617
|
+
style: {
|
|
618
|
+
paddingTop: "1rem",
|
|
619
|
+
},
|
|
620
|
+
children: (0, createDescription_1.createDescription)(message),
|
|
621
|
+
})),
|
|
622
|
+
],
|
|
616
623
|
});
|
|
617
624
|
}
|
|
618
625
|
// handle circular references
|
|
@@ -621,9 +628,16 @@ function createNodes(schema, schemaType) {
|
|
|
621
628
|
style: {
|
|
622
629
|
marginTop: ".5rem",
|
|
623
630
|
marginBottom: ".5rem",
|
|
624
|
-
marginLeft: "1rem",
|
|
625
631
|
},
|
|
626
|
-
children: [
|
|
632
|
+
children: [
|
|
633
|
+
(0, createDescription_1.createDescription)(schema),
|
|
634
|
+
(0, utils_1.guard)((0, schema_1.getQualifierMessage)(schema), (message) => (0, utils_1.create)("div", {
|
|
635
|
+
style: {
|
|
636
|
+
paddingTop: "1rem",
|
|
637
|
+
},
|
|
638
|
+
children: (0, createDescription_1.createDescription)(message),
|
|
639
|
+
})),
|
|
640
|
+
],
|
|
627
641
|
});
|
|
628
642
|
}
|
|
629
643
|
// Unknown node/schema type should return undefined
|
package/lib/markdown/schema.js
CHANGED
|
@@ -35,6 +35,9 @@ function prettyName(schema, circular) {
|
|
|
35
35
|
return (_d = (_c = schema.xml) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : schema.type;
|
|
36
36
|
// return schema.type;
|
|
37
37
|
}
|
|
38
|
+
if (schema.title && schema.type) {
|
|
39
|
+
return `${schema.title} (${schema.type})`;
|
|
40
|
+
}
|
|
38
41
|
return (_e = schema.title) !== null && _e !== void 0 ? _e : schema.type;
|
|
39
42
|
}
|
|
40
43
|
function getSchemaName(schema, circular) {
|
package/lib/markdown/utils.js
CHANGED
package/lib/sidebars/index.js
CHANGED
|
@@ -52,7 +52,7 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
|
|
|
52
52
|
apiTags.push(tag.name);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
apiTags = (0, uniq_1.default)(apiTags.concat(operationTags));
|
|
56
56
|
const basePath = docPath
|
|
57
57
|
? outputDir.split(docPath)[1].replace(/^\/+/g, "")
|
|
58
58
|
: outputDir.slice(outputDir.indexOf("/", 1)).replace(/^\/+/g, "");
|
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.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"@types/mustache": "^4.1.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@apidevtools/json-schema-ref-parser": "^
|
|
39
|
+
"@apidevtools/json-schema-ref-parser": "^11.5.4",
|
|
40
40
|
"@docusaurus/plugin-content-docs": ">=2.4.1 <=2.4.3",
|
|
41
41
|
"@docusaurus/utils": ">=2.4.1 <=2.4.3",
|
|
42
42
|
"@docusaurus/utils-validation": ">=2.4.1 <=2.4.3",
|
|
43
43
|
"@paloaltonetworks/openapi-to-postmanv2": "3.1.0-hotfix.1",
|
|
44
44
|
"@paloaltonetworks/postman-collection": "^4.1.0",
|
|
45
|
-
"@redocly/openapi-core": "^1.
|
|
45
|
+
"@redocly/openapi-core": "^1.10.5",
|
|
46
46
|
"chalk": "^4.1.2",
|
|
47
47
|
"clsx": "^1.1.1",
|
|
48
48
|
"fs-extra": "^9.0.1",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "4bb7040ce39ebe38b2a2837ab0c6a8c477a9a546"
|
|
64
64
|
}
|
|
@@ -35,13 +35,7 @@ Array [
|
|
|
35
35
|
Array [
|
|
36
36
|
</div>
|
|
37
37
|
</li>
|
|
38
|
-
<div
|
|
39
|
-
style={{
|
|
40
|
-
marginTop: \\".5rem\\",
|
|
41
|
-
marginBottom: \\".5rem\\",
|
|
42
|
-
marginLeft: \\"1rem\\",
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
38
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
45
39
|
string
|
|
46
40
|
</div>
|
|
47
41
|
<li>
|
|
@@ -57,35 +51,17 @@ Array [
|
|
|
57
51
|
</li>
|
|
58
52
|
</TabItem>
|
|
59
53
|
<TabItem label={\\"MOD3\\"} value={\\"2-item-properties\\"}>
|
|
60
|
-
<div
|
|
61
|
-
style={{
|
|
62
|
-
marginTop: \\".5rem\\",
|
|
63
|
-
marginBottom: \\".5rem\\",
|
|
64
|
-
marginLeft: \\"1rem\\",
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
54
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
67
55
|
boolean
|
|
68
56
|
</div>
|
|
69
57
|
</TabItem>
|
|
70
58
|
<TabItem label={\\"MOD4\\"} value={\\"3-item-properties\\"}>
|
|
71
|
-
<div
|
|
72
|
-
style={{
|
|
73
|
-
marginTop: \\".5rem\\",
|
|
74
|
-
marginBottom: \\".5rem\\",
|
|
75
|
-
marginLeft: \\"1rem\\",
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
59
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
78
60
|
number
|
|
79
61
|
</div>
|
|
80
62
|
</TabItem>
|
|
81
63
|
<TabItem label={\\"MOD5\\"} value={\\"4-item-properties\\"}>
|
|
82
|
-
<div
|
|
83
|
-
style={{
|
|
84
|
-
marginTop: \\".5rem\\",
|
|
85
|
-
marginBottom: \\".5rem\\",
|
|
86
|
-
marginLeft: \\"1rem\\",
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
64
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
89
65
|
string
|
|
90
66
|
</div>
|
|
91
67
|
</TabItem>
|
|
@@ -624,7 +624,6 @@ function createEdges({
|
|
|
624
624
|
}: { mergedSchemas: SchemaObject; required: string[] | boolean } =
|
|
625
625
|
mergeAllOf(schema.allOf);
|
|
626
626
|
const mergedSchemaName = getSchemaName(mergedSchemas);
|
|
627
|
-
|
|
628
627
|
if (
|
|
629
628
|
mergedSchemas.oneOf !== undefined ||
|
|
630
629
|
mergedSchemas.anyOf !== undefined
|
|
@@ -685,8 +684,8 @@ function createEdges({
|
|
|
685
684
|
collapsible: false,
|
|
686
685
|
name,
|
|
687
686
|
required: Array.isArray(required) ? required.includes(name) : required,
|
|
688
|
-
schemaName:
|
|
689
|
-
qualifierMessage: getQualifierMessage(
|
|
687
|
+
schemaName: mergedSchemaName,
|
|
688
|
+
qualifierMessage: getQualifierMessage(mergedSchemas),
|
|
690
689
|
schema: mergedSchemas,
|
|
691
690
|
});
|
|
692
691
|
}
|
|
@@ -817,9 +816,18 @@ export function createNodes(
|
|
|
817
816
|
style: {
|
|
818
817
|
marginTop: ".5rem",
|
|
819
818
|
marginBottom: ".5rem",
|
|
820
|
-
marginLeft: "1rem",
|
|
821
819
|
},
|
|
822
|
-
children:
|
|
820
|
+
children: [
|
|
821
|
+
createDescription(schema.type),
|
|
822
|
+
guard(getQualifierMessage(schema), (message) =>
|
|
823
|
+
create("div", {
|
|
824
|
+
style: {
|
|
825
|
+
paddingTop: "1rem",
|
|
826
|
+
},
|
|
827
|
+
children: createDescription(message),
|
|
828
|
+
})
|
|
829
|
+
),
|
|
830
|
+
],
|
|
823
831
|
});
|
|
824
832
|
}
|
|
825
833
|
|
|
@@ -829,9 +837,18 @@ export function createNodes(
|
|
|
829
837
|
style: {
|
|
830
838
|
marginTop: ".5rem",
|
|
831
839
|
marginBottom: ".5rem",
|
|
832
|
-
marginLeft: "1rem",
|
|
833
840
|
},
|
|
834
|
-
children: [
|
|
841
|
+
children: [
|
|
842
|
+
createDescription(schema),
|
|
843
|
+
guard(getQualifierMessage(schema), (message) =>
|
|
844
|
+
create("div", {
|
|
845
|
+
style: {
|
|
846
|
+
paddingTop: "1rem",
|
|
847
|
+
},
|
|
848
|
+
children: createDescription(message),
|
|
849
|
+
})
|
|
850
|
+
),
|
|
851
|
+
],
|
|
835
852
|
});
|
|
836
853
|
}
|
|
837
854
|
|
package/src/markdown/schema.ts
CHANGED
package/src/markdown/utils.ts
CHANGED
package/src/sidebars/index.ts
CHANGED