@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,770 @@
|
|
|
1
|
+
import { ElementDisplay } from "../../utils/utils";
|
|
2
|
+
|
|
3
|
+
export const JSON_SCHEMA_SPECIAL_CHARS_FAKE_DATA = '{\n' +
|
|
4
|
+
' "definition": [\n' +
|
|
5
|
+
' "text_input"\n' +
|
|
6
|
+
' ],\n' +
|
|
7
|
+
' "schema": {\n' +
|
|
8
|
+
' "properties": {\n' +
|
|
9
|
+
' "text_input_%": {\n' +
|
|
10
|
+
' "title": "Text input field",\n' +
|
|
11
|
+
' "type": "string"\n' +
|
|
12
|
+
' }\n' +
|
|
13
|
+
' }\n' +
|
|
14
|
+
' }\n' +
|
|
15
|
+
'}';
|
|
16
|
+
|
|
17
|
+
export const JSON_SCHEMA_INVALID_DOUBLE_QUOTES_FAKE_DATA = '{\n' +
|
|
18
|
+
' “definition”: [\n' +
|
|
19
|
+
' “text_input”\n' +
|
|
20
|
+
' ],\n' +
|
|
21
|
+
' “schema”: {\n' +
|
|
22
|
+
' “properties”: {\n' +
|
|
23
|
+
' “text_input”: {\n' +
|
|
24
|
+
' “title”: “Text input field”,\n' +
|
|
25
|
+
' “type”: “string”\n' +
|
|
26
|
+
' }\n' +
|
|
27
|
+
' }\n' +
|
|
28
|
+
' }\n' +
|
|
29
|
+
'}';
|
|
30
|
+
|
|
31
|
+
export const JSON_SCHEMA_EMPTY_CHOICES_FAKE_DATA = '{\n' +
|
|
32
|
+
' "definition": [\n' +
|
|
33
|
+
' "single_select",\n' +
|
|
34
|
+
' {\n' +
|
|
35
|
+
' "htmlClass": "json-schema-checkbox-wrapper",\n' +
|
|
36
|
+
' "key": "checkbox_query",\n' +
|
|
37
|
+
' "titleMap": [],\n' +
|
|
38
|
+
' "type": "checkboxes"\n' +
|
|
39
|
+
' }\n' +
|
|
40
|
+
' ],\n' +
|
|
41
|
+
' "schema": {\n' +
|
|
42
|
+
' "properties": {\n' +
|
|
43
|
+
' "checkbox_query": {\n' +
|
|
44
|
+
' "title": "I\'m a checkbox with query",\n' +
|
|
45
|
+
' "type": "checkboxes"\n' +
|
|
46
|
+
' },\n' +
|
|
47
|
+
' "single_select": {\n' +
|
|
48
|
+
' "enum": [],\n' +
|
|
49
|
+
' "enumNames": {},\n' +
|
|
50
|
+
' "title": "I\'m a single select query",\n' +
|
|
51
|
+
' "type": "string"\n' +
|
|
52
|
+
' },\n' +
|
|
53
|
+
' "single_select_choices": {\n' +
|
|
54
|
+
' "enum": [],\n' +
|
|
55
|
+
' "title": "I\'m a single select choices",\n' +
|
|
56
|
+
' "type": "string"\n' +
|
|
57
|
+
' }\n' +
|
|
58
|
+
' }\n' +
|
|
59
|
+
' }\n' +
|
|
60
|
+
'}';
|
|
61
|
+
|
|
62
|
+
export const JSON_SCHEMA_ID_$SCHEMA_FAKE_DATA = '{\n' +
|
|
63
|
+
' "definition": [\n' +
|
|
64
|
+
' "text_input"\n' +
|
|
65
|
+
' ],\n' +
|
|
66
|
+
' "schema": {\n' +
|
|
67
|
+
' "$schema": "http://json-schema.org/draft-04/schema#",\n' +
|
|
68
|
+
' "id": "https://develop.pamdas.org/api/v1.0/activity/events/schema/eventtype/all_types_required_point",\n' +
|
|
69
|
+
' "properties": {\n' +
|
|
70
|
+
' "text_input": {\n' +
|
|
71
|
+
' "title": "Text input field",\n' +
|
|
72
|
+
' "type": "string"\n' +
|
|
73
|
+
' }\n' +
|
|
74
|
+
' }\n' +
|
|
75
|
+
' }\n' +
|
|
76
|
+
'}';
|
|
77
|
+
|
|
78
|
+
export const JSON_SCHEMA_INACTIVE_CHOICES_FAKE_DATA = '{\n' +
|
|
79
|
+
' "definition": [\n' +
|
|
80
|
+
' "invasivespecies_urgency"\n' +
|
|
81
|
+
' ],\n' +
|
|
82
|
+
' "schema": {\n' +
|
|
83
|
+
' "properties": {\n' +
|
|
84
|
+
' "invasivespecies_urgency": {\n' +
|
|
85
|
+
' "enum": [\n' +
|
|
86
|
+
' "<",\n' +
|
|
87
|
+
' ">",\n' +
|
|
88
|
+
' "=",\n' +
|
|
89
|
+
' "unknown",\n' +
|
|
90
|
+
' "other",\n' +
|
|
91
|
+
' "test"\n' +
|
|
92
|
+
' ],\n' +
|
|
93
|
+
' "enumNames": {\n' +
|
|
94
|
+
' "<": "<",\n' +
|
|
95
|
+
' "=": "=",\n' +
|
|
96
|
+
' ">": ">",\n' +
|
|
97
|
+
' "other": "Other",\n' +
|
|
98
|
+
' "test": "test",\n' +
|
|
99
|
+
' "unknown": "Unknown"\n' +
|
|
100
|
+
' },\n' +
|
|
101
|
+
' "inactive_enum": [\n' +
|
|
102
|
+
' "test"\n' +
|
|
103
|
+
' ],\n' +
|
|
104
|
+
' "title": "Urgency",\n' +
|
|
105
|
+
' "type": "string"\n' +
|
|
106
|
+
' }\n' +
|
|
107
|
+
' }\n' +
|
|
108
|
+
' }\n' +
|
|
109
|
+
'}';
|
|
110
|
+
|
|
111
|
+
export const JSON_SCHEMA_INACTIVE_TITLE_MAP_FAKE_DATA = '{\n' +
|
|
112
|
+
' "definition": [\n' +
|
|
113
|
+
' {\n' +
|
|
114
|
+
' "inactive_titleMap": [\n' +
|
|
115
|
+
' "phot_evidence_collected"\n' +
|
|
116
|
+
' ],\n' +
|
|
117
|
+
' "key": "behavior",\n' +
|
|
118
|
+
' "title": "test checkbox enum",\n' +
|
|
119
|
+
' "titleMap": [\n' +
|
|
120
|
+
' {\n' +
|
|
121
|
+
' "name": "Confirmed automated alerts received",\n' +
|
|
122
|
+
' "value": "confirmed_alerts"\n' +
|
|
123
|
+
' },\n' +
|
|
124
|
+
' {\n' +
|
|
125
|
+
' "name": "Deployed HWCMU",\n' +
|
|
126
|
+
' "value": "deployed_pac"\n' +
|
|
127
|
+
' },\n' +
|
|
128
|
+
' {\n' +
|
|
129
|
+
' "name": "Photographic evidence collected",\n' +
|
|
130
|
+
' "value": "phot_evidence_collected"\n' +
|
|
131
|
+
' }\n' +
|
|
132
|
+
' ],\n' +
|
|
133
|
+
' "type": "checkboxes"\n' +
|
|
134
|
+
' }\n' +
|
|
135
|
+
' ],\n' +
|
|
136
|
+
' "schema": {\n' +
|
|
137
|
+
' "$schema": "http://json-schema.org/draft-04/schema#",\n' +
|
|
138
|
+
' "icon_id": "j93b",\n' +
|
|
139
|
+
' "id": "https://mobile-bash.pamdas.org/api/v1.0/activity/events/schema/eventtype/j93b",\n' +
|
|
140
|
+
' "image_url": "https://mobile-bash.pamdas.org/static/generic-black.svg",\n' +
|
|
141
|
+
' "properties": {\n' +
|
|
142
|
+
' "behavior": {\n' +
|
|
143
|
+
' "title": "test checkbox enum",\n' +
|
|
144
|
+
' "type": "a"\n' +
|
|
145
|
+
' }\n' +
|
|
146
|
+
' },\n' +
|
|
147
|
+
' "title": "Radio Report (radio_rep)",\n' +
|
|
148
|
+
' "type": "object"\n' +
|
|
149
|
+
' }\n' +
|
|
150
|
+
'}';
|
|
151
|
+
|
|
152
|
+
export const JSON_SCHEMA_INACTIVE_FIELD_SET_TITLE_MAP_FAKE_DATA = '{\n' +
|
|
153
|
+
' "definition": [\n' +
|
|
154
|
+
' {\n' +
|
|
155
|
+
' "htmlClass": "col-lg-12",\n' +
|
|
156
|
+
' "items": [],\n' +
|
|
157
|
+
' "title": "Reporters Details",\n' +
|
|
158
|
+
' "type": "fieldset"\n' +
|
|
159
|
+
' },\n' +
|
|
160
|
+
' {\n' +
|
|
161
|
+
' "htmlClass": "col-lg-6",\n' +
|
|
162
|
+
' "items": [\n' +
|
|
163
|
+
' {\n' +
|
|
164
|
+
' "inactive_titleMap": [\n' +
|
|
165
|
+
' "phot_evidence_collected"\n' +
|
|
166
|
+
' ],\n' +
|
|
167
|
+
' "key": "reportorigin",\n' +
|
|
168
|
+
' "title": "test checkbox enum",\n' +
|
|
169
|
+
' "titleMap": [\n' +
|
|
170
|
+
' {\n' +
|
|
171
|
+
' "name": "Confirmed automated alerts received",\n' +
|
|
172
|
+
' "value": "confirmed_alerts"\n' +
|
|
173
|
+
' },\n' +
|
|
174
|
+
' {\n' +
|
|
175
|
+
' "name": "Deployed HWCMU",\n' +
|
|
176
|
+
' "value": "deployed_pac"\n' +
|
|
177
|
+
' },\n' +
|
|
178
|
+
' {\n' +
|
|
179
|
+
' "name": "Photographic evidence collected",\n' +
|
|
180
|
+
' "value": "phot_evidence_collected"\n' +
|
|
181
|
+
' }\n' +
|
|
182
|
+
' ],\n' +
|
|
183
|
+
' "type": "checkboxes"\n' +
|
|
184
|
+
' }\n' +
|
|
185
|
+
' ],\n' +
|
|
186
|
+
' "type": "fieldset"\n' +
|
|
187
|
+
' },\n' +
|
|
188
|
+
' {\n' +
|
|
189
|
+
' "htmlClass": "col-lg-12",\n' +
|
|
190
|
+
' "items": [],\n' +
|
|
191
|
+
' "title": "Reporters Details",\n' +
|
|
192
|
+
' "type": "fieldset"\n' +
|
|
193
|
+
' },\n' +
|
|
194
|
+
' {\n' +
|
|
195
|
+
' "htmlClass": "col-lg-6",\n' +
|
|
196
|
+
' "items": [\n' +
|
|
197
|
+
' "vehicles"\n' +
|
|
198
|
+
' ],\n' +
|
|
199
|
+
' "type": "fieldset"\n' +
|
|
200
|
+
' }\n' +
|
|
201
|
+
' ],\n' +
|
|
202
|
+
' "schema": {\n' +
|
|
203
|
+
' "$schema": "http://json-schema.org/draft-04/schema#",\n' +
|
|
204
|
+
' "icon_id": "fieldsets_disabled_choice",\n' +
|
|
205
|
+
' "id": "https://mobile-bash.pamdas.org/api/v1.0/activity/events/schema/eventtype/fieldsets_disabled_choice",\n' +
|
|
206
|
+
' "image_url": "https://mobile-bash.pamdas.org/static/generic-black.svg",\n' +
|
|
207
|
+
' "properties": {\n' +
|
|
208
|
+
' "reportorigin": {\n' +
|
|
209
|
+
' "enum": [\n' +
|
|
210
|
+
' "choice1",\n' +
|
|
211
|
+
' "choice2"\n' +
|
|
212
|
+
' ],\n' +
|
|
213
|
+
' "enumNames": {\n' +
|
|
214
|
+
' "choice1": "Choice 1",\n' +
|
|
215
|
+
' "choice2": "Choice 2"\n' +
|
|
216
|
+
' },\n' +
|
|
217
|
+
' "title": "Report Origin TEST dropdown enum",\n' +
|
|
218
|
+
' "type": "string"\n' +
|
|
219
|
+
' }\n' +
|
|
220
|
+
' },\n' +
|
|
221
|
+
' "title": "Road Banditry Report",\n' +
|
|
222
|
+
' "type": "object"\n' +
|
|
223
|
+
' }\n' +
|
|
224
|
+
'}';
|
|
225
|
+
export const JSON_SCHEMA_INVALID_DEFINITION_LOCATION_FAKE_DATA = '{\n' +
|
|
226
|
+
' "schema": {\n' +
|
|
227
|
+
' "definition": [\n' +
|
|
228
|
+
' "text_input"\n' +
|
|
229
|
+
' ],\n' +
|
|
230
|
+
' "properties": {\n' +
|
|
231
|
+
' "text_input": {\n' +
|
|
232
|
+
' "title": "Text input field",\n' +
|
|
233
|
+
' "type": "string"\n' +
|
|
234
|
+
' }\n' +
|
|
235
|
+
' }\n' +
|
|
236
|
+
' }\n' +
|
|
237
|
+
'}';
|
|
238
|
+
|
|
239
|
+
export const JSON_SCHEMA_FIELD_SETS_FAKE_DATA = '{\n' +
|
|
240
|
+
' "definition": [\n' +
|
|
241
|
+
' {\n' +
|
|
242
|
+
' "htmlClass": "col-lg-12",\n' +
|
|
243
|
+
' "items": [],\n' +
|
|
244
|
+
' "title": "Fieldset title",\n' +
|
|
245
|
+
' "type": "fieldset"\n' +
|
|
246
|
+
' },\n' +
|
|
247
|
+
' {\n' +
|
|
248
|
+
' "htmlClass": "col-lg-12",\n' +
|
|
249
|
+
' "items": [\n' +
|
|
250
|
+
' "text_input"\n' +
|
|
251
|
+
' ],\n' +
|
|
252
|
+
' "type": "fieldset"\n' +
|
|
253
|
+
' },\n' +
|
|
254
|
+
' {\n' +
|
|
255
|
+
' "htmlClass": "col-lg-12",\n' +
|
|
256
|
+
' "items": [\n' +
|
|
257
|
+
' "text_input_number"\n' +
|
|
258
|
+
' ],\n' +
|
|
259
|
+
' "title": "Fieldset number title",\n' +
|
|
260
|
+
' "type": "fieldset"\n' +
|
|
261
|
+
' }\n' +
|
|
262
|
+
' ],\n' +
|
|
263
|
+
' "schema": {\n' +
|
|
264
|
+
' "properties": {\n' +
|
|
265
|
+
' "text_input": {\n' +
|
|
266
|
+
' "title": "Text input field",\n' +
|
|
267
|
+
' "type": "string"\n' +
|
|
268
|
+
' },\n' +
|
|
269
|
+
' "text_input_number": {\n' +
|
|
270
|
+
' "title": "Text input field",\n' +
|
|
271
|
+
' "type": "string"\n' +
|
|
272
|
+
' }\n' +
|
|
273
|
+
' }\n' +
|
|
274
|
+
' }\n' +
|
|
275
|
+
'}';
|
|
276
|
+
|
|
277
|
+
export const FIELD_SET_HEADER_FAKE_DATA = {
|
|
278
|
+
fieldset__title_fieldset_title: {
|
|
279
|
+
type: 'string',
|
|
280
|
+
readOnly: true,
|
|
281
|
+
isHidden: false,
|
|
282
|
+
display: ElementDisplay.Header,
|
|
283
|
+
title: 'Fieldset title',
|
|
284
|
+
},
|
|
285
|
+
fieldset__title_fieldset_number_title: {
|
|
286
|
+
type: 'string',
|
|
287
|
+
readOnly: true,
|
|
288
|
+
isHidden: false,
|
|
289
|
+
display: ElementDisplay.Header,
|
|
290
|
+
title: 'Fieldset number title',
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const JSON_SCHEMA_COLLECTION_FIELD_FAKE_DATA = '{\n' +
|
|
295
|
+
' "definition": [\n' +
|
|
296
|
+
' {\n' +
|
|
297
|
+
' "helpvalue": "<h2>Exhibits Recovered</h2>",\n' +
|
|
298
|
+
' "type": "help"\n' +
|
|
299
|
+
' },\n' +
|
|
300
|
+
' {\n' +
|
|
301
|
+
' "add": "New",\n' +
|
|
302
|
+
' "key": "SkinsRecovered",\n' +
|
|
303
|
+
' "style": {\n' +
|
|
304
|
+
' "add": "btn-success"\n' +
|
|
305
|
+
' }\n' +
|
|
306
|
+
' }\n' +
|
|
307
|
+
' ],\n' +
|
|
308
|
+
' "schema": {\n' +
|
|
309
|
+
' "properties": {\n' +
|
|
310
|
+
' "SkinsRecovered": {\n' +
|
|
311
|
+
' "isHidden": false,\n' +
|
|
312
|
+
' "items": {\n' +
|
|
313
|
+
' "properties": {\n' +
|
|
314
|
+
' "AnimalSkinType": {\n' +
|
|
315
|
+
' "enum": [\n' +
|
|
316
|
+
' "first",\n' +
|
|
317
|
+
' "second"\n' +
|
|
318
|
+
' ],\n' +
|
|
319
|
+
' "enumNames": [\n' +
|
|
320
|
+
' "first",\n' +
|
|
321
|
+
' "second"\n' +
|
|
322
|
+
' ],\n' +
|
|
323
|
+
' "title": "Animal Skin Type",\n' +
|
|
324
|
+
' "type": "string"\n' +
|
|
325
|
+
' },\n' +
|
|
326
|
+
' "SkinsNumber": {\n' +
|
|
327
|
+
' "minimum": 0,\n' +
|
|
328
|
+
' "title": "Skins Number",\n' +
|
|
329
|
+
' "type": "number"\n' +
|
|
330
|
+
' }\n' +
|
|
331
|
+
' },\n' +
|
|
332
|
+
' "title": "Skin",\n' +
|
|
333
|
+
' "type": "object"\n' +
|
|
334
|
+
' },\n' +
|
|
335
|
+
' "title": " ",\n' +
|
|
336
|
+
' "type": "array"\n' +
|
|
337
|
+
' }\n' +
|
|
338
|
+
' }\n' +
|
|
339
|
+
' }\n' +
|
|
340
|
+
'}';
|
|
341
|
+
|
|
342
|
+
export const COLLECTION_FIELD_HEADER_FAKE_DATA = {
|
|
343
|
+
help_value_0: {
|
|
344
|
+
type: 'string',
|
|
345
|
+
readOnly: true,
|
|
346
|
+
isHidden: false,
|
|
347
|
+
display: ElementDisplay.Header,
|
|
348
|
+
title: 'Exhibits Recovered',
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const JSON_SCHEMA_INLINE_REQUIRED_PROPERTIES = '{\n' +
|
|
353
|
+
' "auto-generate": true,\n' +
|
|
354
|
+
' "definition": [\n' +
|
|
355
|
+
' "string",\n' +
|
|
356
|
+
' {\n' +
|
|
357
|
+
' "key": "paragraph",\n' +
|
|
358
|
+
' "type": "textarea"\n' +
|
|
359
|
+
' },\n' +
|
|
360
|
+
' "number_no_min_max",\n' +
|
|
361
|
+
' "number_with_min",\n' +
|
|
362
|
+
' "number_with_max",\n' +
|
|
363
|
+
' "number_with_min_and_max",\n' +
|
|
364
|
+
' "single_select",\n' +
|
|
365
|
+
' "single_select_choices",\n' +
|
|
366
|
+
' {\n' +
|
|
367
|
+
' "add": "New",\n' +
|
|
368
|
+
' "key": "collection",\n' +
|
|
369
|
+
' "style": {\n' +
|
|
370
|
+
' "add": "btn-success"\n' +
|
|
371
|
+
' }\n' +
|
|
372
|
+
' },\n' +
|
|
373
|
+
' {\n' +
|
|
374
|
+
' "key": "calendar",\n' +
|
|
375
|
+
' "type": "datetime"\n' +
|
|
376
|
+
' },\n' +
|
|
377
|
+
' {\n' +
|
|
378
|
+
' "htmlClass": "json-schema-checkbox-wrapper",\n' +
|
|
379
|
+
' "key": "checkbox_static_choice",\n' +
|
|
380
|
+
' "titleMap": [\n' +
|
|
381
|
+
' {\n' +
|
|
382
|
+
' "name": "Coffee",\n' +
|
|
383
|
+
' "value": "coffee"\n' +
|
|
384
|
+
' },\n' +
|
|
385
|
+
' {\n' +
|
|
386
|
+
' "name": "Water",\n' +
|
|
387
|
+
' "value": "water"\n' +
|
|
388
|
+
' },\n' +
|
|
389
|
+
' {\n' +
|
|
390
|
+
' "name": "Juice",\n' +
|
|
391
|
+
' "value": "juice"\n' +
|
|
392
|
+
' },\n' +
|
|
393
|
+
' {\n' +
|
|
394
|
+
' "name": "Beer",\n' +
|
|
395
|
+
' "value": "beer"\n' +
|
|
396
|
+
' },\n' +
|
|
397
|
+
' {\n' +
|
|
398
|
+
' "name": "Flavor Water",\n' +
|
|
399
|
+
' "value": "flavor_water"\n' +
|
|
400
|
+
' },\n' +
|
|
401
|
+
' {\n' +
|
|
402
|
+
' "name": "Milk",\n' +
|
|
403
|
+
' "value": "milk"\n' +
|
|
404
|
+
' },\n' +
|
|
405
|
+
' {\n' +
|
|
406
|
+
' "name": "Mixed Drink",\n' +
|
|
407
|
+
' "value": "mix_drink"\n' +
|
|
408
|
+
' },\n' +
|
|
409
|
+
' {\n' +
|
|
410
|
+
' "name": "Other",\n' +
|
|
411
|
+
' "value": "other"\n' +
|
|
412
|
+
' },\n' +
|
|
413
|
+
' {\n' +
|
|
414
|
+
' "name": "Rompope",\n' +
|
|
415
|
+
' "value": "rompope"\n' +
|
|
416
|
+
' },\n' +
|
|
417
|
+
' {\n' +
|
|
418
|
+
' "name": "Ron",\n' +
|
|
419
|
+
' "value": "ron"\n' +
|
|
420
|
+
' },\n' +
|
|
421
|
+
' {\n' +
|
|
422
|
+
' "name": "Rum",\n' +
|
|
423
|
+
' "value": "rum"\n' +
|
|
424
|
+
' },\n' +
|
|
425
|
+
' {\n' +
|
|
426
|
+
' "name": "Soda",\n' +
|
|
427
|
+
' "value": "soda"\n' +
|
|
428
|
+
' },\n' +
|
|
429
|
+
' {\n' +
|
|
430
|
+
' "name": "Spark Water",\n' +
|
|
431
|
+
' "value": "spark_water"\n' +
|
|
432
|
+
' },\n' +
|
|
433
|
+
' {\n' +
|
|
434
|
+
' "name": "Tequila",\n' +
|
|
435
|
+
' "value": "tequila"\n' +
|
|
436
|
+
' },\n' +
|
|
437
|
+
' {\n' +
|
|
438
|
+
' "name": "Whisky",\n' +
|
|
439
|
+
' "value": "whisky"\n' +
|
|
440
|
+
' }\n' +
|
|
441
|
+
' ],\n' +
|
|
442
|
+
' "type": "checkboxes"\n' +
|
|
443
|
+
' },\n' +
|
|
444
|
+
' {\n' +
|
|
445
|
+
' "htmlClass": "json-schema-checkbox-wrapper",\n' +
|
|
446
|
+
' "key": "checkbox_query",\n' +
|
|
447
|
+
' "titleMap": [\n' +
|
|
448
|
+
' {\n' +
|
|
449
|
+
' "name": "Rhino",\n' +
|
|
450
|
+
' "value": "rhino_value"\n' +
|
|
451
|
+
' },\n' +
|
|
452
|
+
' {\n' +
|
|
453
|
+
' "name": "Black Rhino",\n' +
|
|
454
|
+
' "value": "blackrhino_value"\n' +
|
|
455
|
+
' },\n' +
|
|
456
|
+
' {\n' +
|
|
457
|
+
' "name": "White Rhino",\n' +
|
|
458
|
+
' "value": "whiterhino"\n' +
|
|
459
|
+
' }\n' +
|
|
460
|
+
' ],\n' +
|
|
461
|
+
' "type": "checkboxes"\n' +
|
|
462
|
+
' }\n' +
|
|
463
|
+
' ],\n' +
|
|
464
|
+
' "description": "This schema will be used for regression testing in the mobile app",\n' +
|
|
465
|
+
' "schema": {\n' +
|
|
466
|
+
' "$schema": "http://json-schema.org/draft-04/schema#",\n' +
|
|
467
|
+
' "icon_id": "hippo_rep",\n' +
|
|
468
|
+
' "id": "https://develop.pamdas.org/api/v1.0/activity/events/schema/eventtype/all_types_required_point",\n' +
|
|
469
|
+
' "image_url": "https://develop.pamdas.org/static/sprite-src/hippo_rep.svg",\n' +
|
|
470
|
+
' "properties": {\n' +
|
|
471
|
+
' "calendar": {\n' +
|
|
472
|
+
' "htmlClass": "col-lg-6",\n' +
|
|
473
|
+
' "readonly": false,\n' +
|
|
474
|
+
' "required": true,\n' +
|
|
475
|
+
' "title": "I\'m a calendar",\n' +
|
|
476
|
+
' "type": "string"\n' +
|
|
477
|
+
' },\n' +
|
|
478
|
+
' "checkbox_query": {\n' +
|
|
479
|
+
' "required": "true",\n' +
|
|
480
|
+
' "title": "I\'m a checkbox with query",\n' +
|
|
481
|
+
' "type": "checkboxes"\n' +
|
|
482
|
+
' },\n' +
|
|
483
|
+
' "checkbox_static_choice": {\n' +
|
|
484
|
+
' "required": 1,\n' +
|
|
485
|
+
' "title": "I\'m a checkbox with static choices",\n' +
|
|
486
|
+
' "type": "checkboxes"\n' +
|
|
487
|
+
' },\n' +
|
|
488
|
+
' "collection": {\n' +
|
|
489
|
+
' "items": {\n' +
|
|
490
|
+
' "properties": {\n' +
|
|
491
|
+
' "ItemConfiscated": {\n' +
|
|
492
|
+
' "enum": [\n' +
|
|
493
|
+
' "trophies",\n' +
|
|
494
|
+
' "weapons",\n' +
|
|
495
|
+
' "bushmeat",\n' +
|
|
496
|
+
' "other"\n' +
|
|
497
|
+
' ],\n' +
|
|
498
|
+
' "enumNames": {\n' +
|
|
499
|
+
' "bushmeat": "Bush Beat",\n' +
|
|
500
|
+
' "other": "Other",\n' +
|
|
501
|
+
' "trophies": "Trophies",\n' +
|
|
502
|
+
' "weapons": "Weapons"\n' +
|
|
503
|
+
' },\n' +
|
|
504
|
+
' "required": true,\n' +
|
|
505
|
+
' "title": "Item Type",\n' +
|
|
506
|
+
' "type": "string"\n' +
|
|
507
|
+
' },\n' +
|
|
508
|
+
' "ItemNumber": {\n' +
|
|
509
|
+
' "minimum": 0,\n' +
|
|
510
|
+
' "required": true,\n' +
|
|
511
|
+
' "title": "Number of Items",\n' +
|
|
512
|
+
' "type": "number"\n' +
|
|
513
|
+
' }\n' +
|
|
514
|
+
' },\n' +
|
|
515
|
+
' "title": "String inside a collection",\n' +
|
|
516
|
+
' "type": "object"\n' +
|
|
517
|
+
' },\n' +
|
|
518
|
+
' "required": true,\n' +
|
|
519
|
+
' "title": "I\'m a collection",\n' +
|
|
520
|
+
' "type": "array"\n' +
|
|
521
|
+
' },\n' +
|
|
522
|
+
' "number_no_min_max": {\n' +
|
|
523
|
+
' "required": true,\n' +
|
|
524
|
+
' "title": "I\'m a number without min-max",\n' +
|
|
525
|
+
' "type": "number"\n' +
|
|
526
|
+
' },\n' +
|
|
527
|
+
' "number_with_max": {\n' +
|
|
528
|
+
' "maximum": 100,\n' +
|
|
529
|
+
' "required": true,\n' +
|
|
530
|
+
' "title": "I\'m a number with a max (100)",\n' +
|
|
531
|
+
' "type": "number"\n' +
|
|
532
|
+
' },\n' +
|
|
533
|
+
' "number_with_min": {\n' +
|
|
534
|
+
' "minimum": 10,\n' +
|
|
535
|
+
' "required": true,\n' +
|
|
536
|
+
' "title": "I\'m a number with a min (10)",\n' +
|
|
537
|
+
' "type": "number"\n' +
|
|
538
|
+
' },\n' +
|
|
539
|
+
' "number_with_min_and_max": {\n' +
|
|
540
|
+
' "maximum": 1000,\n' +
|
|
541
|
+
' "minimum": 80,\n' +
|
|
542
|
+
' "required": true,\n' +
|
|
543
|
+
' "title": "I\'m a number with a min (80) and max (1000)",\n' +
|
|
544
|
+
' "type": "number"\n' +
|
|
545
|
+
' },\n' +
|
|
546
|
+
' "paragraph": {\n' +
|
|
547
|
+
' "required": true,\n' +
|
|
548
|
+
' "title": "I\'m a text area",\n' +
|
|
549
|
+
' "type": "string"\n' +
|
|
550
|
+
' },\n' +
|
|
551
|
+
' "single_select": {\n' +
|
|
552
|
+
' "enum": [\n' +
|
|
553
|
+
' "new",\n' +
|
|
554
|
+
' "impeded",\n' +
|
|
555
|
+
' "old"\n' +
|
|
556
|
+
' ],\n' +
|
|
557
|
+
' "enumNames": {\n' +
|
|
558
|
+
' "impeded": "Impeded",\n' +
|
|
559
|
+
' "new": "New/Fresh",\n' +
|
|
560
|
+
' "old": "Old"\n' +
|
|
561
|
+
' },\n' +
|
|
562
|
+
' "required": true,\n' +
|
|
563
|
+
' "title": "I\'m a single select query",\n' +
|
|
564
|
+
' "type": "string"\n' +
|
|
565
|
+
' },\n' +
|
|
566
|
+
' "single_select_choices": {\n' +
|
|
567
|
+
' "enum": [\n' +
|
|
568
|
+
' "Option 1",\n' +
|
|
569
|
+
' "Option 2",\n' +
|
|
570
|
+
' "Option 3"\n' +
|
|
571
|
+
' ],\n' +
|
|
572
|
+
' "required": true,\n' +
|
|
573
|
+
' "title": "I\'m a single select choices",\n' +
|
|
574
|
+
' "type": "string"\n' +
|
|
575
|
+
' },\n' +
|
|
576
|
+
' "string": {\n' +
|
|
577
|
+
' "required": true,\n' +
|
|
578
|
+
' "title": "I\'m a string",\n' +
|
|
579
|
+
' "type": "string"\n' +
|
|
580
|
+
' }\n' +
|
|
581
|
+
' },\n' +
|
|
582
|
+
' "title": "Schema All Types - Non required",\n' +
|
|
583
|
+
' "type": "object"\n' +
|
|
584
|
+
' }\n' +
|
|
585
|
+
'}'
|
|
586
|
+
|
|
587
|
+
export const JSON_SCHEMA_DEFAULT_VALUES = '{\n' +
|
|
588
|
+
' "schema": {\n' +
|
|
589
|
+
' "type": "object",\n' +
|
|
590
|
+
' "properties": {\n' +
|
|
591
|
+
' "test_one_date": {\n' +
|
|
592
|
+
' "type": "string",\n' +
|
|
593
|
+
' "title": "Test 1 date",\n' +
|
|
594
|
+
' "default": "2023-08-14 15:15",\n' +
|
|
595
|
+
' "isHidden": false\n' +
|
|
596
|
+
' },\n' +
|
|
597
|
+
' "test_two_string": {\n' +
|
|
598
|
+
' "type": "string",\n' +
|
|
599
|
+
' "title": "Test 2 String",\n' +
|
|
600
|
+
' "default": "Test 2",\n' +
|
|
601
|
+
' "isHidden": false\n' +
|
|
602
|
+
' },\n' +
|
|
603
|
+
' "test_three_number": {\n' +
|
|
604
|
+
' "type": "number",\n' +
|
|
605
|
+
' "title": "Test 3 Number With Min and Max",\n' +
|
|
606
|
+
' "minimum": 0,\n' +
|
|
607
|
+
' "default": 25,\n' +
|
|
608
|
+
' "maximum": 50,\n' +
|
|
609
|
+
' "isHidden": false\n' +
|
|
610
|
+
' },\n' +
|
|
611
|
+
' "test_four_number": {\n' +
|
|
612
|
+
' "type": "number",\n' +
|
|
613
|
+
' "default": 6,\n' +
|
|
614
|
+
' "title": "Test 4 Number",\n' +
|
|
615
|
+
' "isHidden": false\n' +
|
|
616
|
+
' },\n' +
|
|
617
|
+
' "test_five_enumString": {\n' +
|
|
618
|
+
' "type": "string",\n' +
|
|
619
|
+
' "title": "Test 5 enum value is a string",\n' +
|
|
620
|
+
' "default": "behavior1",\n' +
|
|
621
|
+
' "enum": [\n' +
|
|
622
|
+
' "0"\n' +
|
|
623
|
+
' ],\n' +
|
|
624
|
+
' "enumNames": {\n' +
|
|
625
|
+
' "0": "No Options"\n' +
|
|
626
|
+
' },\n' +
|
|
627
|
+
' "isHidden": false\n' +
|
|
628
|
+
' },\n' +
|
|
629
|
+
' "test_six_enum_dictionary": {\n' +
|
|
630
|
+
' "type": "string",\n' +
|
|
631
|
+
' "title": "Test 6 enum and dictionary test",\n' +
|
|
632
|
+
' "default": "testone",\n' +
|
|
633
|
+
' "enum": [\n' +
|
|
634
|
+
' "0"\n' +
|
|
635
|
+
' ],\n' +
|
|
636
|
+
' "enumNames": {\n' +
|
|
637
|
+
' "0": "No Options"\n' +
|
|
638
|
+
' },\n' +
|
|
639
|
+
' "isHidden": false\n' +
|
|
640
|
+
' },\n' +
|
|
641
|
+
' "testseven": {\n' +
|
|
642
|
+
' "type": "array",\n' +
|
|
643
|
+
' "uniqueItems": true,\n' +
|
|
644
|
+
' "isHidden": false,\n' +
|
|
645
|
+
' "title": "Test Seven Checkbox Enum",\n' +
|
|
646
|
+
' "items": {\n' +
|
|
647
|
+
' "enum": [\n' +
|
|
648
|
+
' "no_option"\n' +
|
|
649
|
+
' ],\n' +
|
|
650
|
+
' "enumNames": [\n' +
|
|
651
|
+
' "No Option"\n' +
|
|
652
|
+
' ]\n' +
|
|
653
|
+
' },\n' +
|
|
654
|
+
' "default": [\n' +
|
|
655
|
+
' "testseventhree"\n' +
|
|
656
|
+
' ]\n' +
|
|
657
|
+
' },\n' +
|
|
658
|
+
' "test_eight_checkbox_query": {\n' +
|
|
659
|
+
' "type": "array",\n' +
|
|
660
|
+
' "uniqueItems": true,\n' +
|
|
661
|
+
' "isHidden": false,\n' +
|
|
662
|
+
' "title": "Test 8 checkbox query",\n' +
|
|
663
|
+
' "items": {\n' +
|
|
664
|
+
' "enum": [\n' +
|
|
665
|
+
' "no_option"\n' +
|
|
666
|
+
' ],\n' +
|
|
667
|
+
' "enumNames": [\n' +
|
|
668
|
+
' "No Option"\n' +
|
|
669
|
+
' ]\n' +
|
|
670
|
+
' },\n' +
|
|
671
|
+
' "default": [\n' +
|
|
672
|
+
' "9b5cb19e-b7bd-4fa8-9263-8e34502e35ca"\n' +
|
|
673
|
+
' ]\n' +
|
|
674
|
+
' },\n' +
|
|
675
|
+
' "test_nine_dropdown_query": {\n' +
|
|
676
|
+
' "type": "string",\n' +
|
|
677
|
+
' "title": "Test 9 dropdown query dynamic choice on queens",\n' +
|
|
678
|
+
' "default": "9b5cb19e-b7bd-4fa8-9263-8e34502e35ca",\n' +
|
|
679
|
+
' "enum": [\n' +
|
|
680
|
+
' "0"\n' +
|
|
681
|
+
' ],\n' +
|
|
682
|
+
' "enumNames": [],\n' +
|
|
683
|
+
' "isHidden": false\n' +
|
|
684
|
+
' },\n' +
|
|
685
|
+
' "testElevenArrayTest": {\n' +
|
|
686
|
+
' "type": "array",\n' +
|
|
687
|
+
' "title": "Array and Object Test",\n' +
|
|
688
|
+
' "default": [\n' +
|
|
689
|
+
' {\n' +
|
|
690
|
+
' "test_array_string": "string",\n' +
|
|
691
|
+
' "test_array_number": 1\n' +
|
|
692
|
+
' }\n' +
|
|
693
|
+
' ],\n' +
|
|
694
|
+
' "items": {\n' +
|
|
695
|
+
' "type": "object",\n' +
|
|
696
|
+
' "title": "Array and Object Test",\n' +
|
|
697
|
+
' "properties": {\n' +
|
|
698
|
+
' "test_array_string": {\n' +
|
|
699
|
+
' "type": "string",\n' +
|
|
700
|
+
' "title": "Test 2 String"\n' +
|
|
701
|
+
' },\n' +
|
|
702
|
+
' "test_array_number": {\n' +
|
|
703
|
+
' "type": "number",\n' +
|
|
704
|
+
' "title": "Test number",\n' +
|
|
705
|
+
' "minimum": 0\n' +
|
|
706
|
+
' }\n' +
|
|
707
|
+
' }\n' +
|
|
708
|
+
' },\n' +
|
|
709
|
+
' "isHidden": false\n' +
|
|
710
|
+
' },\n' +
|
|
711
|
+
' "test_fourteen_textarea": {\n' +
|
|
712
|
+
' "type": "string",\n' +
|
|
713
|
+
' "default": "Test 14",\n' +
|
|
714
|
+
' "title": "Test 14 Text Area",\n' +
|
|
715
|
+
' "isHidden": false\n' +
|
|
716
|
+
' }\n' +
|
|
717
|
+
' },\n' +
|
|
718
|
+
' "icon_id": "hippo_rep",\n' +
|
|
719
|
+
' "image_url": "https://mobile-bash.pamdas.org/static/sprite-src/hippo_rep.svg",\n' +
|
|
720
|
+
' "required": [\n' +
|
|
721
|
+
' "test_one_date",\n' +
|
|
722
|
+
' "test_two_string"\n' +
|
|
723
|
+
' ]\n' +
|
|
724
|
+
' },\n' +
|
|
725
|
+
' "definition": [\n' +
|
|
726
|
+
' {\n' +
|
|
727
|
+
' "key": "test_one_date",\n' +
|
|
728
|
+
' "fieldHtmlClass": "date-time-picker json-schema"\n' +
|
|
729
|
+
' },\n' +
|
|
730
|
+
' "test_two_string",\n' +
|
|
731
|
+
' "test_three_number",\n' +
|
|
732
|
+
' "test_four_number",\n' +
|
|
733
|
+
' "test_five_enumString",\n' +
|
|
734
|
+
' "test_six_enum_dictionary",\n' +
|
|
735
|
+
' {\n' +
|
|
736
|
+
' "key": "testseven",\n' +
|
|
737
|
+
' "type": "checkboxes",\n' +
|
|
738
|
+
' "titleMap": [\n' +
|
|
739
|
+
' {\n' +
|
|
740
|
+
' "value": "no_option",\n' +
|
|
741
|
+
' "name": "No Option"\n' +
|
|
742
|
+
' }\n' +
|
|
743
|
+
' ]\n' +
|
|
744
|
+
' },\n' +
|
|
745
|
+
' {\n' +
|
|
746
|
+
' "key": "test_eight_checkbox_query",\n' +
|
|
747
|
+
' "type": "checkboxes",\n' +
|
|
748
|
+
' "title": "Test 8 checkbox query",\n' +
|
|
749
|
+
' "titleMap": [\n' +
|
|
750
|
+
' {\n' +
|
|
751
|
+
' "value": "no_option",\n' +
|
|
752
|
+
' "name": "No Option"\n' +
|
|
753
|
+
' }\n' +
|
|
754
|
+
' ],\n' +
|
|
755
|
+
' "htmlClass": "json-schema-checkbox-wrapper"\n' +
|
|
756
|
+
' },\n' +
|
|
757
|
+
' "test_nine_dropdown_query",\n' +
|
|
758
|
+
' {\n' +
|
|
759
|
+
' "key": "testElevenArrayTest",\n' +
|
|
760
|
+
' "add": "New",\n' +
|
|
761
|
+
' "style": {\n' +
|
|
762
|
+
' "add": "btn-success"\n' +
|
|
763
|
+
' }\n' +
|
|
764
|
+
' },\n' +
|
|
765
|
+
' {\n' +
|
|
766
|
+
' "key": "test_fourteen_textarea",\n' +
|
|
767
|
+
' "type": "textarea"\n' +
|
|
768
|
+
' }\n' +
|
|
769
|
+
' ]\n' +
|
|
770
|
+
'}'
|