metadata_presenter 0.1.2 → 0.1.3

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/default_metadata/config/meta.json +24 -0
  3. data/default_metadata/config/service.json +7 -0
  4. data/default_metadata/page/confirmation.json +4 -0
  5. data/default_metadata/page/summary.json +6 -0
  6. data/default_metadata/service/base.json +18 -0
  7. data/default_metadata/string/error.max_length.json +6 -0
  8. data/default_metadata/string/error.min_length.json +6 -0
  9. data/default_metadata/string/error.required.json +7 -0
  10. data/{lib/fixtures → fixtures}/non_finished_service.json +0 -0
  11. data/{lib/fixtures → fixtures}/service.json +0 -0
  12. data/{lib/fixtures → fixtures}/version.json +0 -0
  13. data/lib/metadata_presenter/engine.rb +0 -5
  14. data/lib/metadata_presenter/version.rb +1 -1
  15. data/schemas/condition/condition.json +48 -0
  16. data/schemas/config/meta.json +27 -0
  17. data/schemas/config/service.json +106 -0
  18. data/schemas/definition/block.json +28 -0
  19. data/schemas/definition/component.json +13 -0
  20. data/schemas/definition/components.json +15 -0
  21. data/schemas/definition/condition.base.json +25 -0
  22. data/schemas/definition/condition.boolean.json +25 -0
  23. data/schemas/definition/condition.defined.json +25 -0
  24. data/schemas/definition/condition.expression.json +22 -0
  25. data/schemas/definition/condition.number.json +49 -0
  26. data/schemas/definition/condition.text.json +48 -0
  27. data/schemas/definition/condition.value_type.json +24 -0
  28. data/schemas/definition/conditional.boolean.json +20 -0
  29. data/schemas/definition/conditions.all.json +20 -0
  30. data/schemas/definition/conditions.any.json +26 -0
  31. data/schemas/definition/conditions.exactly.json +26 -0
  32. data/schemas/definition/control.json +75 -0
  33. data/schemas/definition/data.json +28 -0
  34. data/schemas/definition/field.json +26 -0
  35. data/schemas/definition/html_attributes.json +37 -0
  36. data/schemas/definition/label.json +30 -0
  37. data/schemas/definition/link_list.json +30 -0
  38. data/schemas/definition/name.json +18 -0
  39. data/schemas/definition/namespace.json +28 -0
  40. data/schemas/definition/next_page.json +40 -0
  41. data/schemas/definition/page.content.json +23 -0
  42. data/schemas/definition/page.form.json +96 -0
  43. data/schemas/definition/page.json +109 -0
  44. data/schemas/definition/page.singlequestion.json +31 -0
  45. data/schemas/definition/repeatable.json +72 -0
  46. data/schemas/definition/width_class.input.json +48 -0
  47. data/schemas/definition/width_class.json +34 -0
  48. data/schemas/errors/errors.json +139 -0
  49. data/schemas/link/link.json +46 -0
  50. data/schemas/page/confirmation.json +35 -0
  51. data/schemas/page/start.json +34 -0
  52. data/schemas/page/summary.json +63 -0
  53. data/schemas/request/services.json +48 -0
  54. data/schemas/request/versions.json +13 -0
  55. data/schemas/service/base.json +53 -0
  56. data/schemas/service/configuration.json +22 -0
  57. data/schemas/service/locale.json +12 -0
  58. data/schemas/text/text.json +23 -0
  59. data/schemas/validations/validations.json +443 -0
  60. metadata +57 -4
@@ -0,0 +1,13 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/request/versions",
3
+ "_name": "request.versions",
4
+ "title": "Create new service version",
5
+ "description": "Request schema for creating a new version of a service",
6
+ "type": "object",
7
+ "properties": {
8
+ "metadata": {
9
+ "$ref": "service.base"
10
+ }
11
+ },
12
+ "required": ["metadata"]
13
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/service/base",
3
+ "_name": "service.base",
4
+ "title": "Base service schema",
5
+ "description": "Base schema for a service",
6
+ "type": "object",
7
+ "properties": {
8
+ "_id": {
9
+ "const": "service.base"
10
+ },
11
+ "_type": {
12
+ "const": "service.base"
13
+ },
14
+ "service_id": {
15
+ "type": "string"
16
+ },
17
+ "service_name": {
18
+ "type": "string"
19
+ },
20
+ "version_id": {
21
+ "type": "string"
22
+ },
23
+ "created_at": {
24
+ "type": "string"
25
+ },
26
+ "created_by": {
27
+ "type": "string"
28
+ },
29
+ "locale": {
30
+ "$ref": "service.locale"
31
+ },
32
+ "configuration": {
33
+ "$ref": "configuration"
34
+ },
35
+ "pages": {
36
+ "type": "array",
37
+ "items": {
38
+ "$ref": "definition.page"
39
+ }
40
+ }
41
+ },
42
+ "required": [
43
+ "_id",
44
+ "_type",
45
+ "service_id",
46
+ "service_name",
47
+ "created_by",
48
+ "locale",
49
+ "configuration",
50
+ "pages"
51
+ ],
52
+ "additionalProperties": false
53
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/configuration",
3
+ "_name": "configuration",
4
+ "title": "Service configuration",
5
+ "description": "Service configuration",
6
+ "type": "object",
7
+ "properties": {
8
+ "service": {
9
+ "$ref": "config.service"
10
+ },
11
+ "meta": {
12
+ "$ref": "config.meta"
13
+ }
14
+ },
15
+ "required": [
16
+ "service",
17
+ "meta"
18
+ ],
19
+ "category": [
20
+ "configuration"
21
+ ]
22
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/service/locale",
3
+ "_name": "service.locale",
4
+ "title": "Service version locale",
5
+ "description": "The locale of a version of a service",
6
+ "type": "string",
7
+ "default": "en",
8
+ "enum": [
9
+ "en",
10
+ "cy"
11
+ ]
12
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/text",
3
+ "_name": "text",
4
+ "title": "Text",
5
+ "description": "Let users enter text that’s no longer than a single line",
6
+ "type": "object",
7
+ "properties": {
8
+ "_type": {
9
+ "const": "text"
10
+ }
11
+ },
12
+ "allOf": [
13
+ {
14
+ "$ref": "definition.field"
15
+ },
16
+ {
17
+ "$ref": "validations#/definitions/string_bundle"
18
+ },
19
+ {
20
+ "$ref": "definition.width_class.input"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,443 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/validations",
3
+ "_name": "validations",
4
+ "title": "Validations",
5
+ "type": "object",
6
+ "definitions": {
7
+ "error_strings": {
8
+ "type": "object",
9
+ "properties": {
10
+ "any": {
11
+ "title": "Error message",
12
+ "description": "Error message users see if their answer fails validation - write {control} to show the question in the message",
13
+ "type": "string",
14
+ "role": "error_string"
15
+ }
16
+ }
17
+ },
18
+ "required": {
19
+ "title": "Required",
20
+ "description": "Whether the user must answer a question",
21
+ "oneOf": [
22
+ {
23
+ "$ref": "definition.conditional.boolean"
24
+ }
25
+ ],
26
+ "default": true
27
+ },
28
+ "errors_required": {
29
+ "title": "Error messages for ‘Required’",
30
+ "allOf": [
31
+ {
32
+ "$ref": "#/definitions/error_strings"
33
+ }
34
+ ]
35
+ },
36
+ "errors_accept": {
37
+ "title": "Error messages for ‘Accept’",
38
+ "allOf": [
39
+ {
40
+ "$ref": "#/definitions/error_strings"
41
+ }
42
+ ]
43
+ },
44
+ "errors_max_size": {
45
+ "title": "Error messages for ‘Max Size’",
46
+ "allOf": [
47
+ {
48
+ "$ref": "#/definitions/error_strings"
49
+ }
50
+ ]
51
+ },
52
+ "min_length": {
53
+ "title": "Minimum length",
54
+ "description": "The minimum characters users must enter",
55
+ "type": "number",
56
+ "minimum": 0
57
+ },
58
+ "errors_min_length": {
59
+ "title": "Error messages for ‘Minimum length’",
60
+ "allOf": [
61
+ {
62
+ "$ref": "#/definitions/error_strings"
63
+ }
64
+ ]
65
+ },
66
+ "max_length": {
67
+ "title": "Maximum length",
68
+ "description": "The maximum characters users can enter",
69
+ "type": "number",
70
+ "minimum": 0
71
+ },
72
+ "errors_max_length": {
73
+ "title": "Error messages for ‘Maximum length’",
74
+ "allOf": [
75
+ {
76
+ "$ref": "#/definitions/error_strings"
77
+ }
78
+ ]
79
+ },
80
+ "pattern": {
81
+ "title": "Pattern to match string against",
82
+ "description": "A regular expression for validating users’ answers",
83
+ "type": "string"
84
+ },
85
+ "errors_pattern": {
86
+ "title": "Error messages for pattern",
87
+ "allOf": [
88
+ {
89
+ "$ref": "#/definitions/error_strings"
90
+ }
91
+ ]
92
+ },
93
+ "format": {
94
+ "title": "Format to match string against",
95
+ "description": "Format used for validating users’ answers",
96
+ "type": "string"
97
+ },
98
+ "errors_format": {
99
+ "title": "Error messages for format",
100
+ "allOf": [
101
+ {
102
+ "$ref": "#/definitions/error_strings"
103
+ }
104
+ ]
105
+ },
106
+ "multiple_of": {
107
+ "title": "Multiple of",
108
+ "description": "Whether users must enter a multiple of another number",
109
+ "type": "number",
110
+ "minimum": 0
111
+ },
112
+ "errors_multiple_of": {
113
+ "title": "Error messages for ‘Multiple of’",
114
+ "allOf": [
115
+ {
116
+ "$ref": "#/definitions/error_strings"
117
+ }
118
+ ]
119
+ },
120
+ "maximum": {
121
+ "title": "Maximum value",
122
+ "description": "The largest number that users can enter",
123
+ "type": "number",
124
+ "minimum": 0
125
+ },
126
+ "errors_maximum": {
127
+ "title": "Error messages for ‘Maximum value’",
128
+ "allOf": [
129
+ {
130
+ "$ref": "#/definitions/error_strings"
131
+ }
132
+ ]
133
+ },
134
+ "exclusive_maximum": {
135
+ "title": "Is maximum value exclusive?",
136
+ "description": "Excludes the maximum value from the range users can enter",
137
+ "type": "boolean"
138
+ },
139
+ "errors_exclusive_maximum": {
140
+ "title": "Error messages for ‘Maximum value is exclusive",
141
+ "allOf": [
142
+ {
143
+ "$ref": "#/definitions/error_strings"
144
+ }
145
+ ]
146
+ },
147
+ "minimum": {
148
+ "title": "Minimum value",
149
+ "description": "The smallest number that users can enter",
150
+ "type": "number",
151
+ "minimum": 0
152
+ },
153
+ "errors_minimum": {
154
+ "title": "Error messages for for ‘Minimum value’",
155
+ "allOf": [
156
+ {
157
+ "$ref": "#/definitions/error_strings"
158
+ }
159
+ ]
160
+ },
161
+ "exclusive_minimum": {
162
+ "title": "Is minimum value exclusive?",
163
+ "description": "Excludes the minimum value from the range users can enter",
164
+ "type": "boolean"
165
+ },
166
+ "errors_exclusive_minimum": {
167
+ "title": "Error messages for ‘Minimum value is exclusive",
168
+ "allOf": [
169
+ {
170
+ "$ref": "#/definitions/error_strings"
171
+ }
172
+ ]
173
+ },
174
+ "date_before": {
175
+ "title": "Before date",
176
+ "description": "Date which user input must be before - eg. 2000-10-24",
177
+ "type": "string",
178
+ "format": "date"
179
+ },
180
+ "errors_date_before": {
181
+ "title": "Error messages for ‘Before date’",
182
+ "allOf": [
183
+ {
184
+ "$ref": "#/definitions/error_strings"
185
+ }
186
+ ]
187
+ },
188
+ "date_after": {
189
+ "title": "After date",
190
+ "description": "Date which user input must be after - eg. 2000-10-24",
191
+ "type": "string",
192
+ "format": "date"
193
+ },
194
+ "errors_date_after": {
195
+ "title": "Error messages for ‘After date’",
196
+ "allOf": [
197
+ {
198
+ "$ref": "#/definitions/error_strings"
199
+ }
200
+ ]
201
+ },
202
+ "date_within_next": {
203
+ "title": "Within next",
204
+ "description": "Date which user input must be before - eg. 1y, 4Mm, 2w, 100d",
205
+ "type": "object",
206
+ "properties": {
207
+ "amount": {
208
+ "type": "number"
209
+ },
210
+ "unit": {
211
+ "type": "string",
212
+ "enum": [
213
+ "years",
214
+ "months",
215
+ "weeks",
216
+ "days"
217
+ ]
218
+ }
219
+ },
220
+ "required": [
221
+ "amount",
222
+ "unit"
223
+ ]
224
+ },
225
+ "errors_date_within_next": {
226
+ "title": "Error messages for ‘Within next’",
227
+ "allOf": [
228
+ {
229
+ "$ref": "#/definitions/error_strings"
230
+ }
231
+ ]
232
+ },
233
+ "date_within_last": {
234
+ "title": "Within last",
235
+ "description": "Date which user input must be before - eg. 1y, 4Mm, 2w, 100d",
236
+ "type": "object",
237
+ "properties": {
238
+ "amount": {
239
+ "type": "number"
240
+ },
241
+ "unit": {
242
+ "type": "string",
243
+ "enum": [
244
+ "years",
245
+ "months",
246
+ "weeks",
247
+ "days"
248
+ ]
249
+ }
250
+ },
251
+ "required": [
252
+ "amount",
253
+ "unit"
254
+ ]
255
+ },
256
+ "errors_date_within_last": {
257
+ "title": "Error messages for ‘Within last’",
258
+ "allOf": [
259
+ {
260
+ "$ref": "#/definitions/error_strings"
261
+ }
262
+ ]
263
+ },
264
+ "required_bundle": {
265
+ "properties": {
266
+ "validation": {
267
+ "title": "Validation",
268
+ "description": "Values for default validation",
269
+ "role": "validation",
270
+ "properties": {
271
+ "required": {
272
+ "$ref": "#/definitions/required"
273
+ }
274
+ }
275
+ },
276
+ "errors": {
277
+ "title": "Errors",
278
+ "description": "Strings to override for default error messages",
279
+ "role": "error_strings",
280
+ "properties": {
281
+ "required": {
282
+ "$ref": "#/definitions/errors_required"
283
+ }
284
+ }
285
+ }
286
+ }
287
+ },
288
+ "upload_bundle": {
289
+ "properties": {
290
+ "validation": {
291
+ "title": "Validation",
292
+ "description": "Values for default validation",
293
+ "role": "validation",
294
+ "properties": {
295
+ "accept": {
296
+ "title": "Accepted types",
297
+ "description": "Which file types to accept",
298
+ "type": "array",
299
+ "items": {
300
+ "type": "string"
301
+ }
302
+ },
303
+ "max_size": {
304
+ "title": "Maximum size",
305
+ "description": "Maximum file size as human readable string or bytes",
306
+ "type": "string"
307
+ }
308
+ }
309
+ },
310
+ "errors": {
311
+ "title": "Errors",
312
+ "description": "Strings to override for default error messages",
313
+ "role": "error_strings",
314
+ "properties": {
315
+ "accept": {
316
+ "$ref": "#/definitions/errors_accept"
317
+ },
318
+ "maxSize": {
319
+ "$ref": "#/definitions/errors_max_size"
320
+ }
321
+ }
322
+ }
323
+ }
324
+ },
325
+ "string_bundle": {
326
+ "properties": {
327
+ "validation": {
328
+ "properties": {
329
+ "min_length": {
330
+ "$ref": "#/definitions/min_length"
331
+ },
332
+ "max_length": {
333
+ "$ref": "#/definitions/max_length"
334
+ },
335
+ "pattern": {
336
+ "$ref": "#/definitions/pattern"
337
+ },
338
+ "format": {
339
+ "$ref": "#/definitions/format"
340
+ }
341
+ }
342
+ },
343
+ "errors": {
344
+ "properties": {
345
+ "min_length": {
346
+ "$ref": "#/definitions/errors_min_length"
347
+ },
348
+ "max_length": {
349
+ "$ref": "#/definitions/errors_max_length"
350
+ },
351
+ "pattern": {
352
+ "$ref": "#/definitions/errors_pattern"
353
+ },
354
+ "format": {
355
+ "$ref": "#/definitions/errors_format"
356
+ }
357
+ }
358
+ }
359
+ }
360
+ },
361
+ "number_bundle": {
362
+ "properties": {
363
+ "validation": {
364
+ "properties": {
365
+ "multiple_of": {
366
+ "$ref": "#/definitions/multiple_of"
367
+ },
368
+ "maximum": {
369
+ "$ref": "#/definitions/maximum"
370
+ },
371
+ "exclusive_maximum": {
372
+ "$ref": "#/definitions/exclusive_maximum"
373
+ },
374
+ "minimum": {
375
+ "$ref": "#/definitions/minimum"
376
+ },
377
+ "exclusive_minimum": {
378
+ "$ref": "#/definitions/exclusive_minimum"
379
+ }
380
+ }
381
+ },
382
+ "errors": {
383
+ "properties": {
384
+ "multiple_of": {
385
+ "$ref": "#/definitions/errors_multiple_of"
386
+ },
387
+ "maximum": {
388
+ "$ref": "#/definitions/errors_maximum"
389
+ },
390
+ "exclusive_maximum": {
391
+ "$ref": "#/definitions/errors_exclusive_maximum"
392
+ },
393
+ "minimum": {
394
+ "$ref": "#/definitions/errors_minimum"
395
+ },
396
+ "exclusive_minimum": {
397
+ "$ref": "#/definitions/errors_exclusive_minimum"
398
+ }
399
+ }
400
+ }
401
+ }
402
+ },
403
+ "date_bundle": {
404
+ "properties": {
405
+ "validation": {
406
+ "properties": {
407
+ "date_before": {
408
+ "$ref": "#/definitions/date_before"
409
+ },
410
+ "date_after": {
411
+ "$ref": "#/definitions/date_after"
412
+ },
413
+ "date_within_next": {
414
+ "$ref": "#/definitions/date_within_next"
415
+ },
416
+ "date_within_last": {
417
+ "$ref": "#/definitions/date_within_last"
418
+ }
419
+ }
420
+ },
421
+ "errors": {
422
+ "properties": {
423
+ "date_before": {
424
+ "$ref": "#/definitions/errors_date_before"
425
+ },
426
+ "date_after": {
427
+ "$ref": "#/definitions/errors_date_after"
428
+ },
429
+ "date_within_next": {
430
+ "$ref": "#/definitions/errors_date_within_next"
431
+ },
432
+ "date_within_last": {
433
+ "$ref": "#/definitions/errors_date_within_last"
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
439
+ },
440
+ "category": [
441
+ "definition"
442
+ ]
443
+ }