Skip to content

Commit d7bbe20

Browse files
committed
Ensure qualifiers are rendered for polymorphic/primitive properties (#765)
* ensure qualifiers are rendered for polymorphic properties * update createSchema test
1 parent f28711e commit d7bbe20

File tree

2 files changed

+26
-32
lines changed

2 files changed

+26
-32
lines changed

packages/docusaurus-plugin-openapi-docs/src/markdown/__snapshots__/createSchema.test.ts.snap

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ Array [
3535
Array [
3636
</div>
3737
</li>
38-
<div
39-
style={{
40-
marginTop: \\".5rem\\",
41-
marginBottom: \\".5rem\\",
42-
marginLeft: \\"1rem\\",
43-
}}
44-
>
38+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
4539
string
4640
</div>
4741
<li>
@@ -57,35 +51,17 @@ Array [
5751
</li>
5852
</TabItem>
5953
<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\\" }}>
6755
boolean
6856
</div>
6957
</TabItem>
7058
<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\\" }}>
7860
number
7961
</div>
8062
</TabItem>
8163
<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\\" }}>
8965
string
9066
</div>
9167
</TabItem>

packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,18 @@ export function createNodes(
817817
style: {
818818
marginTop: ".5rem",
819819
marginBottom: ".5rem",
820-
marginLeft: "1rem",
821820
},
822-
children: createDescription(schema.type),
821+
children: [
822+
createDescription(schema.type),
823+
guard(getQualifierMessage(schema), (message) =>
824+
create("div", {
825+
style: {
826+
paddingTop: "1rem",
827+
},
828+
children: createDescription(message),
829+
})
830+
),
831+
],
823832
});
824833
}
825834

@@ -829,9 +838,18 @@ export function createNodes(
829838
style: {
830839
marginTop: ".5rem",
831840
marginBottom: ".5rem",
832-
marginLeft: "1rem",
833841
},
834-
children: [createDescription(schema)],
842+
children: [
843+
createDescription(schema),
844+
guard(getQualifierMessage(schema), (message) =>
845+
create("div", {
846+
style: {
847+
paddingTop: "1rem",
848+
},
849+
children: createDescription(message),
850+
})
851+
),
852+
],
835853
});
836854
}
837855

0 commit comments

Comments
 (0)