Skip to content

Commit 43e5ccf

Browse files
authored
Merge pull request #14 from jy95/boolean-fix
fix: boolean printout for enum / default / const values
2 parents 6f2ff0f + 2b0b13c commit 43e5ccf

File tree

12 files changed

+973
-1041
lines changed

12 files changed

+973
-1041
lines changed

__tests__/JSONSchemaViewer/__snapshots__/array.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ exports[`JSONSchemaViewer - Array type test 5 1`] = `
429429
</code>
430430
 
431431
<span>
432-
unknown
432+
string
433433
</span>
434434
</summary>
435435
<strong>
@@ -443,7 +443,7 @@ exports[`JSONSchemaViewer - Array type test 5 1`] = `
443443
}
444444
}
445445
>
446-
unknown
446+
string
447447
</span>
448448
<div
449449
style={
@@ -483,7 +483,7 @@ exports[`JSONSchemaViewer - Array type test 5 1`] = `
483483
</code>
484484
 
485485
<span>
486-
unknown
486+
string
487487
</span>
488488
</summary>
489489
<strong>
@@ -497,7 +497,7 @@ exports[`JSONSchemaViewer - Array type test 5 1`] = `
497497
}
498498
}
499499
>
500-
unknown
500+
string
501501
</span>
502502
<div
503503
style={

__tests__/JSONSchemaViewer/__snapshots__/boolean.test.tsx.snap

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,63 @@ exports[`JSONSchemaViewer - Boolean type test 0 1`] = `
3131
/>
3232
</details>
3333
`;
34+
35+
exports[`JSONSchemaViewer - Boolean type test 1 1`] = `
36+
<details
37+
open={true}
38+
>
39+
<summary>
40+
<strong>
41+
Schema
42+
</strong>
43+
</summary>
44+
<strong>
45+
type
46+
</strong>
47+
 : 
48+
<span
49+
style={
50+
{
51+
"opacity": "0.6",
52+
}
53+
}
54+
>
55+
boolean
56+
</span>
57+
<div
58+
style={
59+
{
60+
"marginTop": "var(--ifm-table-cell-padding)",
61+
}
62+
}
63+
>
64+
<div>
65+
<strong>
66+
Possible values :
67+
</strong>
68+
 
69+
<code>
70+
[true,false]
71+
</code>
72+
</div>
73+
<div>
74+
<strong>
75+
Default value :
76+
</strong>
77+
 
78+
<code>
79+
false
80+
</code>
81+
</div>
82+
</div>
83+
<div
84+
style={
85+
{
86+
"marginTop": "var(--ifm-table-cell-padding)",
87+
}
88+
}
89+
>
90+
Boolean without the explict type
91+
</div>
92+
</details>
93+
`;

__tests__/JSONSchemaViewer/__snapshots__/generateFriendlyName.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ exports[`JSONSchemaViewer - generateFriendlyName cases test Prefer title 1`] = `
11671167
</strong>
11681168
 
11691169
<span>
1170-
unknown
1170+
string
11711171
</span>
11721172
</summary>
11731173
<strong>
@@ -1181,7 +1181,7 @@ exports[`JSONSchemaViewer - generateFriendlyName cases test Prefer title 1`] = `
11811181
}
11821182
}
11831183
>
1184-
unknown
1184+
string
11851185
</span>
11861186
<div
11871187
style={

__tests__/JSONSchemaViewer/__snapshots__/generic_keywords.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports[`JSONSchemaViewer - Generic keywords test annotations 1`] = `
4848
</div>
4949
<div>
5050
<strong>
51-
Possible values :
51+
Example values :
5252
</strong>
5353
 
5454
<div
@@ -148,7 +148,7 @@ exports[`JSONSchemaViewer - Generic keywords test const 1`] = `
148148
</strong>
149149
 
150150
<span>
151-
unknown
151+
string
152152
</span>
153153
</summary>
154154
<strong>
@@ -162,7 +162,7 @@ exports[`JSONSchemaViewer - Generic keywords test const 1`] = `
162162
}
163163
}
164164
>
165-
unknown
165+
string
166166
</span>
167167
<div
168168
style={
@@ -214,7 +214,7 @@ exports[`JSONSchemaViewer - Generic keywords test enum 1`] = `
214214
}
215215
}
216216
>
217-
unknown
217+
string
218218
</span>
219219
<div
220220
style={

__tests__/JSONSchemaViewer/__snapshots__/object.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ exports[`JSONSchemaViewer - object test additionalProperties (JSON Schema) 1`] =
145145
</strong>
146146
 
147147
<span>
148-
unknown
148+
string
149149
</span>
150150
</summary>
151151
<strong>
@@ -159,7 +159,7 @@ exports[`JSONSchemaViewer - object test additionalProperties (JSON Schema) 1`] =
159159
}
160160
}
161161
>
162-
unknown
162+
string
163163
</span>
164164
<div
165165
style={
@@ -331,7 +331,7 @@ exports[`JSONSchemaViewer - object test additionalProperties (false) 1`] = `
331331
</strong>
332332
 
333333
<span>
334-
unknown
334+
string
335335
</span>
336336
</summary>
337337
<strong>
@@ -345,7 +345,7 @@ exports[`JSONSchemaViewer - object test additionalProperties (false) 1`] = `
345345
}
346346
}
347347
>
348-
unknown
348+
string
349349
</span>
350350
<div
351351
style={
@@ -899,7 +899,7 @@ exports[`JSONSchemaViewer - object test properties 1`] = `
899899
</strong>
900900
 
901901
<span>
902-
unknown
902+
string
903903
</span>
904904
</summary>
905905
<strong>
@@ -913,7 +913,7 @@ exports[`JSONSchemaViewer - object test properties 1`] = `
913913
}
914914
}
915915
>
916-
unknown
916+
string
917917
</span>
918918
<div
919919
style={

__tests__/JSONSchemaViewer/__snapshots__/schema_conditionally.test.tsx.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
6868
</strong>
6969
 
7070
<span>
71-
unknown
71+
string
7272
</span>
7373
</summary>
7474
<strong>
@@ -82,7 +82,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
8282
}
8383
}
8484
>
85-
unknown
85+
string
8686
</span>
8787
<div
8888
style={
@@ -231,7 +231,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
231231
</strong>
232232
 
233233
<span>
234-
unknown
234+
string
235235
</span>
236236
</summary>
237237
<strong>
@@ -245,7 +245,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
245245
}
246246
}
247247
>
248-
unknown
248+
string
249249
</span>
250250
<div
251251
style={
@@ -431,7 +431,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
431431
</strong>
432432
 
433433
<span>
434-
unknown
434+
string
435435
</span>
436436
 
437437
<strong>
@@ -449,7 +449,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
449449
}
450450
}
451451
>
452-
unknown
452+
string
453453
</span>
454454
<div
455455
style={
@@ -635,7 +635,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
635635
</strong>
636636
 
637637
<span>
638-
unknown
638+
string
639639
</span>
640640
 
641641
<strong>
@@ -653,7 +653,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else (multiple) 1`
653653
}
654654
}
655655
>
656-
unknown
656+
string
657657
</span>
658658
<div
659659
style={
@@ -839,7 +839,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else 1`] = `
839839
</strong>
840840
 
841841
<span>
842-
unknown
842+
string
843843
</span>
844844
</summary>
845845
<strong>
@@ -853,7 +853,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else 1`] = `
853853
}
854854
}
855855
>
856-
unknown
856+
string
857857
</span>
858858
<div
859859
style={
@@ -967,7 +967,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else 1`] = `
967967
</strong>
968968
 
969969
<span>
970-
unknown
970+
string
971971
</span>
972972
</summary>
973973
<strong>
@@ -981,7 +981,7 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else 1`] = `
981981
}
982982
}
983983
>
984-
unknown
984+
string
985985
</span>
986986
<div
987987
style={

__tests__/JSONSchemaViewer/boolean.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ const testcases: JSONSchema[] = [
1717
{
1818
type: "boolean",
1919
},
20+
{
21+
enum: [true, false],
22+
default: false,
23+
description: "Boolean without the explict type",
24+
},
2025
]
2126

2227
describe("JSONSchemaViewer - Boolean type", () => {

0 commit comments

Comments
 (0)