metadata_presenter 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/validators/metadata_presenter/validate_schema.rb +1 -2
  3. data/app/views/metadata_presenter/page/summary.html.erb +4 -3
  4. data/config/routes.rb +1 -1
  5. data/default_metadata/config/meta.json +24 -0
  6. data/default_metadata/config/service.json +4 -0
  7. data/default_metadata/page/confirmation.json +4 -0
  8. data/default_metadata/page/summary.json +6 -0
  9. data/default_metadata/service/base.json +18 -0
  10. data/default_metadata/string/error.max_length.json +6 -0
  11. data/default_metadata/string/error.min_length.json +6 -0
  12. data/default_metadata/string/error.required.json +7 -0
  13. data/fixtures/non_finished_service.json +123 -0
  14. data/fixtures/service.json +51 -0
  15. data/fixtures/version.json +146 -0
  16. data/lib/metadata_presenter/version.rb +1 -1
  17. data/schemas/condition/condition.json +48 -0
  18. data/schemas/config/meta.json +27 -0
  19. data/schemas/config/service.json +106 -0
  20. data/schemas/definition/block.json +28 -0
  21. data/schemas/definition/component.json +13 -0
  22. data/schemas/definition/components.json +15 -0
  23. data/schemas/definition/condition.base.json +25 -0
  24. data/schemas/definition/condition.boolean.json +25 -0
  25. data/schemas/definition/condition.defined.json +25 -0
  26. data/schemas/definition/condition.expression.json +22 -0
  27. data/schemas/definition/condition.number.json +49 -0
  28. data/schemas/definition/condition.text.json +48 -0
  29. data/schemas/definition/condition.value_type.json +24 -0
  30. data/schemas/definition/conditional.boolean.json +20 -0
  31. data/schemas/definition/conditions.all.json +20 -0
  32. data/schemas/definition/conditions.any.json +26 -0
  33. data/schemas/definition/conditions.exactly.json +26 -0
  34. data/schemas/definition/control.json +75 -0
  35. data/schemas/definition/data.json +28 -0
  36. data/schemas/definition/field.json +26 -0
  37. data/schemas/definition/html_attributes.json +37 -0
  38. data/schemas/definition/label.json +30 -0
  39. data/schemas/definition/link_list.json +30 -0
  40. data/schemas/definition/name.json +18 -0
  41. data/schemas/definition/namespace.json +28 -0
  42. data/schemas/definition/next_page.json +40 -0
  43. data/schemas/definition/page.content.json +23 -0
  44. data/schemas/definition/page.form.json +96 -0
  45. data/schemas/definition/page.json +109 -0
  46. data/schemas/definition/page.singlequestion.json +31 -0
  47. data/schemas/definition/repeatable.json +72 -0
  48. data/schemas/definition/width_class.input.json +48 -0
  49. data/schemas/definition/width_class.json +34 -0
  50. data/schemas/errors/errors.json +139 -0
  51. data/schemas/link/link.json +46 -0
  52. data/schemas/page/confirmation.json +35 -0
  53. data/schemas/page/start.json +34 -0
  54. data/schemas/page/summary.json +63 -0
  55. data/schemas/request/service.json +13 -0
  56. data/schemas/service/base.json +52 -0
  57. data/schemas/service/configuration.json +22 -0
  58. data/schemas/service/locale.json +12 -0
  59. data/schemas/text/text.json +23 -0
  60. data/schemas/validations/validations.json +443 -0
  61. metadata +57 -2
@@ -0,0 +1,23 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/page/content",
3
+ "_name": "definition.page.content",
4
+ "title": "Content page definition",
5
+ "properties": {
6
+ "components": {
7
+ "accepts": [
8
+ "content"
9
+ ]
10
+ }
11
+ },
12
+ "allOf": [
13
+ {
14
+ "$ref": "definition.page"
15
+ }
16
+ ],
17
+ "required": [
18
+ "heading"
19
+ ],
20
+ "category": [
21
+ "contentPage"
22
+ ]
23
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/page/form",
3
+ "_name": "definition.page.form",
4
+ "title": "Form page definition",
5
+ "properties": {
6
+ "extra_components": {
7
+ "title": "Additional components",
8
+ "description": "Components following continue button",
9
+ "type": "array",
10
+ "items": {
11
+ "$ref": "definition.component"
12
+ },
13
+ "accepts": [
14
+ "content"
15
+ ],
16
+ "category": [
17
+ "additional"
18
+ ]
19
+ },
20
+ "section_heading": {
21
+ "title": "Section heading",
22
+ "description": "Name of section",
23
+ "type": "string",
24
+ "content": true,
25
+ "category": [
26
+ "content"
27
+ ]
28
+ },
29
+ "section_heading_summary": {
30
+ "title": "Section heading (Summary version)",
31
+ "description": "A condensed version of the section heading, for use on the 'check your answers' page",
32
+ "type": "string",
33
+ "content": true,
34
+ "category": [
35
+ "content"
36
+ ]
37
+ },
38
+ "heading_summary": {
39
+ "title": "Heading (Summary version)",
40
+ "description": "A condensed version of the page heading, for use on the 'check your answers' page",
41
+ "type": "string",
42
+ "content": true,
43
+ "category": [
44
+ "content"
45
+ ]
46
+ },
47
+ "steps_heading": {
48
+ "title": "Steps heading",
49
+ "description": "Name of section to use on step pages (if any)",
50
+ "type": "string",
51
+ "category": [
52
+ "content"
53
+ ]
54
+ },
55
+ "steps": {
56
+ "title": "Steps",
57
+ "description": "The ‘child’ pages that follow from this ‘parent’ page",
58
+ "type": "array",
59
+ "items": {
60
+ "type": "string"
61
+ }
62
+ },
63
+ "enable_steps": {
64
+ "title": "Enable steps",
65
+ "description": "Allow current page to have steps",
66
+ "type": "boolean"
67
+ },
68
+ "show_steps": {
69
+ "title": "Steps visibility",
70
+ "category": [
71
+ "logic"
72
+ ],
73
+ "description": "Whether to show or hide the page’s steps",
74
+ "oneOf": [
75
+ {
76
+ "$ref": "definition.conditional.boolean"
77
+ }
78
+ ],
79
+ "default": true
80
+ },
81
+ "nextPage": {
82
+ "$ref": "definition.next_page"
83
+ }
84
+ },
85
+ "allOf": [
86
+ {
87
+ "$ref": "definition.page"
88
+ },
89
+ {
90
+ "$ref": "definition.repeatable"
91
+ }
92
+ ],
93
+ "category": [
94
+ "form_page"
95
+ ]
96
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/page",
3
+ "_name": "definition.page",
4
+ "id_seed": "url",
5
+ "title": "Page definition",
6
+ "properties": {
7
+ "url": {
8
+ "title": "URL",
9
+ "description": "The page’s relative url - it must not contain any spaces",
10
+ "type": "string",
11
+ "pattern": "^[\\w\\-_\\/]+$"
12
+ },
13
+ "heading": {
14
+ "title": "Heading",
15
+ "description": "The page’s top-level heading (H1) - appears at the top of the page",
16
+ "type": "string",
17
+ "content": true
18
+ },
19
+ "title": {
20
+ "title": "Title",
21
+ "description": "The text to use as the page’s title in the document title element - uses heading value by default",
22
+ "type": "string",
23
+ "content": true,
24
+ "category": [
25
+ "content"
26
+ ]
27
+ },
28
+ "lede": {
29
+ "title": "First paragraph",
30
+ "description": "Introductory paragraph after the heading (it‘s also known as the ‘lede’) - use [markdown](https://www.gov.uk/guidance/how-to-publish-on-gov-uk/markdown) to format text or add hyperlinks",
31
+ "type": "string",
32
+ "content": true,
33
+ "category": [
34
+ "content"
35
+ ]
36
+ },
37
+ "body": {
38
+ "title": "Content",
39
+ "description": "Free-form content after the heading and first paragraph - use [markdown](https://www.gov.uk/guidance/how-to-publish-on-gov-uk/markdown) to format text or add hyperlinks",
40
+ "type": "string",
41
+ "content": true,
42
+ "multiline": true,
43
+ "category": [
44
+ "content"
45
+ ]
46
+ },
47
+ "cookie_message": {
48
+ "title": "Cookie message",
49
+ "description": "Set dynamically - exists here to enable formatting of value",
50
+ "type": "string",
51
+ "content": true,
52
+ "default": "[% cookie.message %]",
53
+ "category": [
54
+ "dynamic"
55
+ ]
56
+ },
57
+ "action_type": {
58
+ "title": "Primary action",
59
+ "description": "Text for primary action button",
60
+ "type": "string",
61
+ "enum": [
62
+ "continue",
63
+ "save_continue",
64
+ "save",
65
+ "confirm",
66
+ "send.email",
67
+ "send.sms",
68
+ "custom-1",
69
+ "custom-2",
70
+ "custom-3",
71
+ "custom-4",
72
+ "custom-5"
73
+ ],
74
+ "default": "continue",
75
+ "category": [
76
+ "additional"
77
+ ]
78
+ },
79
+ "back_link": {
80
+ "title": "Back link text",
81
+ "type": "string",
82
+ "default": "[% link.back %]",
83
+ "content": true,
84
+ "category": [
85
+ "additional"
86
+ ]
87
+ }
88
+ },
89
+ "allOf": [
90
+ {
91
+ "$ref": "definition.block"
92
+ },
93
+ {
94
+ "$ref": "definition.components"
95
+ }
96
+ ],
97
+ "required": [
98
+ "url"
99
+ ],
100
+ "category": [
101
+ "definition",
102
+ "page"
103
+ ],
104
+ "transforms": {
105
+ "namespace": {
106
+ "propagation": "components[?(@.$control || @.$grouping)]"
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/page/singlequestion",
3
+ "_name": "page.singlequestion",
4
+ "title": "Single question",
5
+ "description": "Ask users one question on a page (you can make the question repeatable for additional answers)",
6
+ "type": "object",
7
+ "properties": {
8
+ "_type": {
9
+ "const": "page.singlequestion"
10
+ },
11
+ "components": {
12
+ "maxItems": 1,
13
+ "accepts": [
14
+ "control"
15
+ ]
16
+ }
17
+ },
18
+ "allOf": [
19
+ {
20
+ "$ref": "definition.page.form"
21
+ }
22
+ ],
23
+ "required": [
24
+ "components"
25
+ ],
26
+ "surplus_properties": [
27
+ "heading",
28
+ "lede",
29
+ "body"
30
+ ]
31
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/repeatable",
3
+ "_name": "definition.repeatable",
4
+ "title": "Repeatable definition",
5
+ "type": "object",
6
+ "properties": {
7
+ "repeatable": {
8
+ "title": "Repeatable",
9
+ "description": "Whether the page or component lets users ‘add another’ answer",
10
+ "type": "boolean"
11
+ },
12
+ "repeatable_minimum": {
13
+ "title": "Minimum number of repeatable items",
14
+ "description": "For example, if users must give at least 3 answers, set this to 3 - the page will show 3 inputs when it loads",
15
+ "type": "number",
16
+ "minimum": 0,
17
+ "default": 1,
18
+ "category": [
19
+ "repeatable"
20
+ ]
21
+ },
22
+ "repeatable_maximum": {
23
+ "title": "Maximum number of repeatable items",
24
+ "description": "For example, if users can give up to 5 answers, set this to 5",
25
+ "type": "number",
26
+ "minimum": 0,
27
+ "category": [
28
+ "repeatable"
29
+ ]
30
+ },
31
+ "repeatable_heading": {
32
+ "title": "Repeatable section heading",
33
+ "description": "Heading for repeatable items - appears once before the components",
34
+ "type": "string",
35
+ "category": [
36
+ "repeatable"
37
+ ]
38
+ },
39
+ "repeatable_lede": {
40
+ "title": "Repeatable section first paragraph",
41
+ "description": "Introductory paragraph - follows the heading",
42
+ "type": "string",
43
+ "category": [
44
+ "repeatable"
45
+ ]
46
+ },
47
+ "repeatable_add": {
48
+ "title": "Text to add another answer",
49
+ "description": "Specify the link text for users to add another answer - defaults to ‘Add another’",
50
+ "type": "string",
51
+ "category": [
52
+ "repeatable"
53
+ ]
54
+ },
55
+ "repeatable_delete": {
56
+ "title": "Text to remove an answer",
57
+ "description": "Specify the link text for users to delete an answer - defaults to ‘Remove’",
58
+ "type": "string",
59
+ "category": [
60
+ "repeatable"
61
+ ]
62
+ }
63
+ },
64
+ "allOf": [
65
+ {
66
+ "$ref": "definition.namespace"
67
+ }
68
+ ],
69
+ "category": [
70
+ "definition"
71
+ ]
72
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/width_class/input",
3
+ "_name": "definition.width_class.input",
4
+ "title": "Input width class definition",
5
+ "properties": {
6
+ "width_class_input": {
7
+ "title": "Input width",
8
+ "description": "How wide the input should be visually",
9
+ "type": "string",
10
+ "enum_map": {
11
+ "2": "2 characters",
12
+ "3": "3 characters",
13
+ "4": "4 characters",
14
+ "5": "5 characters",
15
+ "10": "10 characters",
16
+ "20": "20 characters",
17
+ "30": "30 characters",
18
+ "one-quarter": "One quarter",
19
+ "one-third": "One third",
20
+ "one-half": "One half",
21
+ "two-thirds": "Two thirds",
22
+ "three-quarters": "Three quarters",
23
+ "full": "Full width"
24
+ },
25
+ "enum": [
26
+ "2",
27
+ "3",
28
+ "4",
29
+ "5",
30
+ "10",
31
+ "20",
32
+ "30",
33
+ "one-quarter",
34
+ "one-third",
35
+ "one-half",
36
+ "two-thirds",
37
+ "three-quarters",
38
+ "full"
39
+ ],
40
+ "category": [
41
+ "html_attributes"
42
+ ]
43
+ }
44
+ },
45
+ "category": [
46
+ "definition"
47
+ ]
48
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/definition/width_class",
3
+ "_name": "definition.width_class",
4
+ "title": "Width class definition",
5
+ "properties": {
6
+ "width_class": {
7
+ "title": "Width",
8
+ "description": "How wide the component should be visually",
9
+ "type": "string",
10
+ "enum_map": {
11
+ "one-quarter": "One quarter",
12
+ "one-third": "One third",
13
+ "one-half": "One half",
14
+ "two-thirds": "Two thirds",
15
+ "three-quarters": "Three quarters",
16
+ "full": "Full width"
17
+ },
18
+ "enum": [
19
+ "one-quarter",
20
+ "one-third",
21
+ "one-half",
22
+ "two-thirds",
23
+ "three-quarters",
24
+ "full"
25
+ ],
26
+ "category": [
27
+ "html_attributes"
28
+ ]
29
+ }
30
+ },
31
+ "category": [
32
+ "definition"
33
+ ]
34
+ }
@@ -0,0 +1,139 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/errors",
3
+ "_name": "errors",
4
+ "title": "Error strings",
5
+ "type": "object",
6
+ "definitions": {
7
+ "error_strings": {
8
+ "type": "object",
9
+ "properties": {
10
+ "any": {
11
+ "type": "string"
12
+ }
13
+ }
14
+ },
15
+ "required": {
16
+ "title": "Error strings for required",
17
+ "allOf": [
18
+ {
19
+ "$ref": "#/definitions/error_strings"
20
+ }
21
+ ]
22
+ },
23
+ "min_length": {
24
+ "title": "Error strings for minimum length",
25
+ "allOf": [
26
+ {
27
+ "$ref": "#/definitions/error_strings"
28
+ }
29
+ ]
30
+ },
31
+ "max_length": {
32
+ "title": "Error strings for maximum length",
33
+ "allOf": [
34
+ {
35
+ "$ref": "#/definitions/error_strings"
36
+ }
37
+ ]
38
+ },
39
+ "pattern": {
40
+ "title": "Error strings for pattern",
41
+ "allOf": [
42
+ {
43
+ "$ref": "#/definitions/error_strings"
44
+ }
45
+ ]
46
+ },
47
+ "multiple_of": {
48
+ "title": "Error strings for multiple of",
49
+ "allOf": [
50
+ {
51
+ "$ref": "#/definitions/error_strings"
52
+ }
53
+ ]
54
+ },
55
+ "maximum": {
56
+ "title": "Error strings for maximum",
57
+ "allOf": [
58
+ {
59
+ "$ref": "#/definitions/error_strings"
60
+ }
61
+ ]
62
+ },
63
+ "exclusive_maximum": {
64
+ "title": "Error strings for exclusive maximum",
65
+ "allOf": [
66
+ {
67
+ "$ref": "#/definitions/error_strings"
68
+ }
69
+ ]
70
+ },
71
+ "minimum": {
72
+ "title": "Error strings for minimum",
73
+ "allOf": [
74
+ {
75
+ "$ref": "#/definitions/error_strings"
76
+ }
77
+ ]
78
+ },
79
+ "exclusive_minimum": {
80
+ "title": "Error strings for exclusive minimum",
81
+ "allOf": [
82
+ {
83
+ "$ref": "#/definitions/error_strings"
84
+ }
85
+ ]
86
+ },
87
+ "required_errors": {
88
+ "properties": {
89
+ "errors": {
90
+ "properties": {
91
+ "required": {
92
+ "$ref": "#/definitions/required"
93
+ }
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "string_errors": {
99
+ "properties": {
100
+ "errors": {
101
+ "properties": {
102
+ "min_length": {
103
+ "$ref": "#/definitions/min_length"
104
+ },
105
+ "max_length": {
106
+ "$ref": "#/definitions/max_length"
107
+ },
108
+ "pattern": {
109
+ "$ref": "#/definitions/pattern"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ },
115
+ "number_errors": {
116
+ "properties": {
117
+ "errors": {
118
+ "properties": {
119
+ "multiple_of": {
120
+ "$ref": "#/definitions/multiple_of"
121
+ },
122
+ "maximum": {
123
+ "$ref": "#/definitions/maximum"
124
+ },
125
+ "exclusive_maximum": {
126
+ "$ref": "#/definitions/exclusive_maximum"
127
+ },
128
+ "minimum": {
129
+ "$ref": "#/definitions/minimum"
130
+ },
131
+ "exclusive_minimum": {
132
+ "$ref": "#/definitions/exclusive_minimum"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }