Skip to content

Commit

Permalink
Add introduction guidance (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
petechd authored Mar 4, 2022
1 parent 0613d24 commit 400fdcd
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 14 deletions.
11 changes: 10 additions & 1 deletion schemas/blocks/introduction.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/contents"
}
},
"additionalProperties": false
"additionalProperties": true,
"required": ["id"],
"anyOf": [
{
"required": ["title"]
},
{
"required": ["contents"]
}
]
}
},
"preview_content": {
Expand Down
15 changes: 15 additions & 0 deletions schemas/common_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
},
{
"required": ["definition"]
},
{
"required": ["guidance"]
}
],
"properties": {
Expand All @@ -59,6 +62,9 @@
},
"definition": {
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/definition"
},
"guidance": {
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/guidance"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -406,5 +412,14 @@
"interviewer_only": {
"description": "Marks the page as for the interviewer only. Only applies for questionnaires that will be completed by an interviewer.",
"type": "boolean"
},
"guidance": {
"description": "Question or contents guidance",
"type": "object",
"properties": {
"contents": {
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/contents"
}
}
}
}
9 changes: 0 additions & 9 deletions schemas/questions/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
}
]
},
"question_guidance": {
"description": "Question guidance",
"type": "object",
"properties": {
"contents": {
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/contents"
}
}
},
"summary": {
"description": "TextField string concatenations for the summary page",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/questions/types/calculated.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/question_definitions"
},
"guidance": {
"$ref": "https://eq.ons.gov.uk/questions/definitions.json#/question_guidance"
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/guidance"
},
"type": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion schemas/questions/types/date_range.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/non_empty_string"
},
"guidance": {
"$ref": "https://eq.ons.gov.uk/questions/definitions.json#/question_guidance"
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/guidance"
},
"type": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion schemas/questions/types/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/question_definitions"
},
"guidance": {
"$ref": "https://eq.ons.gov.uk/questions/definitions.json#/question_guidance"
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/guidance"
},
"summary": {
"$ref": "https://eq.ons.gov.uk/questions/definitions.json#/summary"
Expand Down
2 changes: 1 addition & 1 deletion schemas/questions/types/mutually_exclusive.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/question_definitions"
},
"guidance": {
"$ref": "https://eq.ons.gov.uk/questions/definitions.json#/question_guidance"
"$ref": "https://eq.ons.gov.uk/common_definitions.json#/guidance"
},
"type": {
"type": "string",
Expand Down
85 changes: 85 additions & 0 deletions tests/schemas/valid/test_introduction_with_guidance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"mime_type": "application/json/ons/eq",
"language": "en",
"schema_version": "0.0.1",
"data_version": "0.0.3",
"survey_id": "144",
"theme": "default",
"title": "Test introduction",
"legal_basis": "Notice is given under section 999 of the Test Act 2000",
"metadata": [
{
"name": "user_id",
"type": "string"
},
{
"name": "period_id",
"type": "string"
},
{
"name": "ru_name",
"type": "string"
},
{
"name": "ru_ref",
"type": "string"
},
{
"name": "trad_as",
"type": "string",
"optional": true
}
],
"questionnaire_flow": {
"type": "Linear",
"options": {}
},
"sections": [
{
"id": "introduction-section",
"title": "Introduction",
"groups": [
{
"id": "introduction-group",
"title": "General Business Information",
"blocks": [
{
"id": "introduction",
"type": "Introduction",
"primary_content": [
{
"id": "business-details",
"title": "You are completing this for ESSENTIAL ENTERPRISE LTD.",
"contents": [
{
"guidance": {
"contents": [
{
"title": "Coronavirus (COVID-19) guidance",
"description": "<strong>Explain your figures</strong> in the comment section to minimise us contacting you and to help us tell an industry story"
}
]
}
}
]
}
]
},
{
"type": "Interstitial",
"id": "general-business-information-completed",
"content": {
"title": "Section complete",
"contents": [
{
"description": "<p>You have successfully completed this section</p>"
}
]
}
}
]
}
]
}
]
}

0 comments on commit 400fdcd

Please sign in to comment.