@earthranger/react-native-jsonforms-formatter 0.1.0
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/ jest.config.js +4 -0
- package/.eslintrc.cjs +18 -0
- package/.githooks/pre-commit +3 -0
- package/.github/CODEOWNERS +2 -0
- package/.github/workflows/npm-build.yml +40 -0
- package/LICENSE +201 -0
- package/README.md +51 -0
- package/babel.config.cjs +6 -0
- package/extJestSetup.js +3 -0
- package/package.json +68 -0
- package/src/__test__/JsonFormatter.test.tsx +168 -0
- package/src/common/mockData/formatterMockData.ts +770 -0
- package/src/common/mockData/jsonSchemaExpectedMock.json +318 -0
- package/src/common/mockData/jsonSchemaFielSetMock.json +972 -0
- package/src/common/mockData/jsonSchemaMock.json +250 -0
- package/src/common/mockData/uiSchemaExpectedMock.json +103 -0
- package/src/common/mockData/uiSchemaFielSetExpectedMock.json +297 -0
- package/src/generateUISchema.ts +164 -0
- package/src/index.ts +2 -0
- package/src/utils/utils.ts +83 -0
- package/src/validateJsonSchema.ts +275 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
{
|
|
2
|
+
"auto-generate": true,
|
|
3
|
+
"description": "This schema will be used for regression testing in the mobile app",
|
|
4
|
+
"schema": {
|
|
5
|
+
"title": "Schema All Types - Non required",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"string",
|
|
9
|
+
"number_no_min_max",
|
|
10
|
+
"number_with_min",
|
|
11
|
+
"number_with_max",
|
|
12
|
+
"number_with_min_and_max",
|
|
13
|
+
"paragraph",
|
|
14
|
+
"checkbox_static_choice",
|
|
15
|
+
"checkbox_query",
|
|
16
|
+
"calendar",
|
|
17
|
+
"calendar_clock",
|
|
18
|
+
"single_select",
|
|
19
|
+
"single_select_choices",
|
|
20
|
+
"collection"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"string": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"title": "I'm a string",
|
|
26
|
+
"isHidden": false
|
|
27
|
+
},
|
|
28
|
+
"paragraph": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"title": "I'm a text area",
|
|
31
|
+
"isHidden": false
|
|
32
|
+
},
|
|
33
|
+
"number_no_min_max": {
|
|
34
|
+
"type": "number",
|
|
35
|
+
"title": "I'm a number without min-max",
|
|
36
|
+
"isHidden": false
|
|
37
|
+
},
|
|
38
|
+
"number_with_min": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"title": "I'm a number with a min (10)",
|
|
41
|
+
"minimum": 10,
|
|
42
|
+
"isHidden": false
|
|
43
|
+
},
|
|
44
|
+
"number_with_max": {
|
|
45
|
+
"type": "number",
|
|
46
|
+
"title": "I'm a number with a max (100)",
|
|
47
|
+
"maximum": 100,
|
|
48
|
+
"isHidden": false
|
|
49
|
+
},
|
|
50
|
+
"number_with_min_and_max": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"title": "I'm a number with a min (80) and max (1000)",
|
|
53
|
+
"minimum": 80,
|
|
54
|
+
"maximum": 1000,
|
|
55
|
+
"isHidden": false
|
|
56
|
+
},
|
|
57
|
+
"single_select": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"title": "I'm a single select query",
|
|
60
|
+
"enum": [
|
|
61
|
+
"new",
|
|
62
|
+
"impeded",
|
|
63
|
+
"old"
|
|
64
|
+
],
|
|
65
|
+
"enumNames": {
|
|
66
|
+
"new": "New/Fresh",
|
|
67
|
+
"impeded": "Impeded",
|
|
68
|
+
"old": "Old"
|
|
69
|
+
},
|
|
70
|
+
"isHidden": false
|
|
71
|
+
},
|
|
72
|
+
"single_select_choices": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"title": "I'm a single select choices",
|
|
75
|
+
"enum": [
|
|
76
|
+
"Option 1",
|
|
77
|
+
"Option 2",
|
|
78
|
+
"Option 3"
|
|
79
|
+
],
|
|
80
|
+
"isHidden": false
|
|
81
|
+
},
|
|
82
|
+
"help_value_0": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"readOnly": true,
|
|
85
|
+
"isHidden": false,
|
|
86
|
+
"display": "header",
|
|
87
|
+
"title": "Collection header"
|
|
88
|
+
},
|
|
89
|
+
"collection": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"title": "I'm a collection",
|
|
92
|
+
"items": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"title": "String inside a collection",
|
|
95
|
+
"properties": {
|
|
96
|
+
"ItemConfiscated": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"title": "Item Type",
|
|
99
|
+
"enum": [
|
|
100
|
+
"trophies",
|
|
101
|
+
"weapons",
|
|
102
|
+
"bushmeat",
|
|
103
|
+
"other"
|
|
104
|
+
],
|
|
105
|
+
"enumNames": {
|
|
106
|
+
"trophies": "Trophies",
|
|
107
|
+
"weapons": "Weapons",
|
|
108
|
+
"bushmeat": "Bush Beat",
|
|
109
|
+
"other": "Other"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"ItemNumber": {
|
|
113
|
+
"type": "number",
|
|
114
|
+
"title": "Number of Items",
|
|
115
|
+
"minimum": 0
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"isHidden": false
|
|
120
|
+
},
|
|
121
|
+
"calendar_clock": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"htmlClass": "col-lg-6",
|
|
124
|
+
"readonly": false,
|
|
125
|
+
"title": "I'm a calendar with clock",
|
|
126
|
+
"isHidden": false
|
|
127
|
+
},
|
|
128
|
+
"calendar": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"title": "I'm a calendar",
|
|
131
|
+
"format": "date",
|
|
132
|
+
"isHidden": false
|
|
133
|
+
},
|
|
134
|
+
"checkbox_static_choice": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"uniqueItems": true,
|
|
137
|
+
"isHidden": false,
|
|
138
|
+
"title": "I'm a checkbox with static choices",
|
|
139
|
+
"items": {
|
|
140
|
+
"enum": [
|
|
141
|
+
"coffee",
|
|
142
|
+
"water",
|
|
143
|
+
"juice",
|
|
144
|
+
"beer",
|
|
145
|
+
"flavor_water",
|
|
146
|
+
"milk",
|
|
147
|
+
"mix_drink",
|
|
148
|
+
"other",
|
|
149
|
+
"rompope",
|
|
150
|
+
"ron",
|
|
151
|
+
"rum",
|
|
152
|
+
"soda",
|
|
153
|
+
"spark_water",
|
|
154
|
+
"tequila",
|
|
155
|
+
"whisky"
|
|
156
|
+
],
|
|
157
|
+
"enumNames": [
|
|
158
|
+
"Coffee",
|
|
159
|
+
"Water",
|
|
160
|
+
"Juice",
|
|
161
|
+
"Beer",
|
|
162
|
+
"Flavor Water",
|
|
163
|
+
"Milk",
|
|
164
|
+
"Mixed Drink",
|
|
165
|
+
"Other",
|
|
166
|
+
"Rompope",
|
|
167
|
+
"Ron",
|
|
168
|
+
"Rum",
|
|
169
|
+
"Soda",
|
|
170
|
+
"Spark Water",
|
|
171
|
+
"Tequila",
|
|
172
|
+
"Whisky"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"checkbox_query": {
|
|
177
|
+
"type": "array",
|
|
178
|
+
"uniqueItems": true,
|
|
179
|
+
"isHidden": false,
|
|
180
|
+
"title": "I'm a checkbox with query",
|
|
181
|
+
"items": {
|
|
182
|
+
"enum": [
|
|
183
|
+
"rhino_value",
|
|
184
|
+
"blackrhino_value",
|
|
185
|
+
"whiterhino"
|
|
186
|
+
],
|
|
187
|
+
"enumNames": [
|
|
188
|
+
"Rhino",
|
|
189
|
+
"Black Rhino",
|
|
190
|
+
"White Rhino"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"icon_id": "hippo_rep",
|
|
196
|
+
"image_url": "https://develop.pamdas.org/static/sprite-src/hippo_rep.svg"
|
|
197
|
+
},
|
|
198
|
+
"definition": [
|
|
199
|
+
"string",
|
|
200
|
+
{
|
|
201
|
+
"key": "paragraph",
|
|
202
|
+
"type": "textarea"
|
|
203
|
+
},
|
|
204
|
+
"number_no_min_max",
|
|
205
|
+
"number_with_min",
|
|
206
|
+
"number_with_max",
|
|
207
|
+
"number_with_min_and_max",
|
|
208
|
+
"single_select",
|
|
209
|
+
"single_select_choices",
|
|
210
|
+
{
|
|
211
|
+
"helpvalue": "<h2>Collection header</h2>",
|
|
212
|
+
"type": "help"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"key": "collection",
|
|
216
|
+
"add": "New",
|
|
217
|
+
"style": {
|
|
218
|
+
"add": "btn-success"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"key": "calendar_clock",
|
|
223
|
+
"type": "datetime"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"key": "calendar",
|
|
227
|
+
"type": "",
|
|
228
|
+
"fieldHtmlClass": "date-picker json-schema",
|
|
229
|
+
"readonly": false
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"key": "checkbox_static_choice",
|
|
233
|
+
"type": "checkboxes",
|
|
234
|
+
"titleMap": [
|
|
235
|
+
{
|
|
236
|
+
"value": "coffee",
|
|
237
|
+
"name": "Coffee"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"value": "water",
|
|
241
|
+
"name": "Water"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"value": "juice",
|
|
245
|
+
"name": "Juice"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"value": "beer",
|
|
249
|
+
"name": "Beer"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"value": "flavor_water",
|
|
253
|
+
"name": "Flavor Water"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"value": "milk",
|
|
257
|
+
"name": "Milk"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"value": "mix_drink",
|
|
261
|
+
"name": "Mixed Drink"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"value": "other",
|
|
265
|
+
"name": "Other"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"value": "rompope",
|
|
269
|
+
"name": "Rompope"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"value": "ron",
|
|
273
|
+
"name": "Ron"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"value": "rum",
|
|
277
|
+
"name": "Rum"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"value": "soda",
|
|
281
|
+
"name": "Soda"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"value": "spark_water",
|
|
285
|
+
"name": "Spark Water"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"value": "tequila",
|
|
289
|
+
"name": "Tequila"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"value": "whisky",
|
|
293
|
+
"name": "Whisky"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"htmlClass": "json-schema-checkbox-wrapper"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"htmlClass": "json-schema-checkbox-wrapper",
|
|
300
|
+
"key": "checkbox_query",
|
|
301
|
+
"titleMap": [
|
|
302
|
+
{
|
|
303
|
+
"name": "Rhino",
|
|
304
|
+
"value": "rhino_value"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "Black Rhino",
|
|
308
|
+
"value": "blackrhino_value"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"name": "White Rhino",
|
|
312
|
+
"value": "whiterhino"
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"type": "checkboxes"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
}
|