From 8c27ae6ffc63ec17ca4594462bd11522a3e30ea2 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 11 Nov 2021 11:39:02 +0000 Subject: [PATCH] Validate structure correctly --- app/helpers/json_schema_validation.rb | 3 +- config/forms/schema/2021_2022.json | 2230 ++--------------------- config/forms/schema/generic.json | 140 +- config/forms/schema/test.json | 108 -- spec/fixtures/forms/test_form.json | 18 - spec/fixtures/forms/test_validator.json | 3 +- 6 files changed, 191 insertions(+), 2311 deletions(-) delete mode 100644 config/forms/schema/test.json delete mode 100644 spec/fixtures/forms/test_form.json diff --git a/app/helpers/json_schema_validation.rb b/app/helpers/json_schema_validation.rb index 12084b020..dd0655d3b 100644 --- a/app/helpers/json_schema_validation.rb +++ b/app/helpers/json_schema_validation.rb @@ -13,8 +13,7 @@ end begin - # path = "config/forms/schema/generic.json" - path = "config/forms/schema/test.json" + path = "config/forms/schema/generic.json" # path = "config/forms/schema/2021_2022.json" file = File.open(path) diff --git a/config/forms/schema/2021_2022.json b/config/forms/schema/2021_2022.json index 2a825ffb8..cd8f13530 100644 --- a/config/forms/schema/2021_2022.json +++ b/config/forms/schema/2021_2022.json @@ -1,2134 +1,112 @@ { - "form_type": "lettings", - "start_year": 2021, - "end_year": 2022, + "$schema": "http://json-schema.org/draft-04/schema#", + "$id": "https://example.com/product.schema.json", + "title": "Form", + "description": "A form", + "type": "object", + "required": ["form_type", "start_year", "end_year", "sections"], + "properties": { + "form_type": { + "description": "", + "type": "string" + }, + "start_year": { + "description": "", + "type": "integer" + }, + "end_year": { + "description": "", + "type": "integer" + }, "sections": { - "household": { - "label": "About the household", - "subsections": { - "household_characteristics": { - "label": "Household characteristics", - "pages": { - "tenant_code": { - "header": "", - "description": "", - "questions": { - "tenant_code": { - "check_answer_label": "Tenant code", - "header": "What is the tenant code?", - "hint_text": "", - "type": "text" - } - } - }, - "person_1_age": { - "header": "", - "description": "", - "questions": { - "person_1_age": { - "check_answer_label": "Tenant's age", - "header": "What is the tenant's age?", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 120, - "step": 1 - } - } - }, - "person_1_gender": { - "header": "", - "description": "", - "questions": { - "person_1_gender": { - "check_answer_label": "Tenant's gender", - "header": "Which of these best describes the tenant's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - } - } - }, - "tenant_ethnic_group": { - "header": "", - "description": "", - "questions": { - "tenant_ethnic_group": { - "check_answer_label": "Ethnicity", - "header": "What is the tenant's ethnic group?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "White: English/Scottish/Welsh/Northern Irish/British", - "1": "White: Irish", - "2": "White: Gypsy/Irish Traveller", - "3": "White: Other", - "4": "Mixed: White & Black Caribbean", - "5": "Mixed: White & Black African", - "6": "Mixed: White & Asian", - "7": "Mixed: Other", - "8": "Asian or Asian British: Indian", - "9": "Asian or Asian British: Pakistani", - "10": "Asian or Asian British: Bangladeshi", - "11": "Asian or Asian British: Chinese", - "12": "Asian or Asian British: Other", - "13": "Black: Caribbean", - "14": "Black: African", - "15": "Black: Other", - "16": "Other Ethnic Group: Arab", - "17": "Other Ethnic Group: Other", - "18": "Prefer not to say" - } - } - } - }, - "tenant_nationality": { - "header": "", - "description": "", - "questions": { - "tenant_nationality": { - "check_answer_label": "Nationality", - "header": "What is the tenant's nationality?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "UK national resident in UK", - "1": "A current or former reserve in the UK Armed Forces (exc. National Service)", - "2": "UK national returning from residence overseas", - "3": "Czech Republic", - "4": "Estonia", - "5": "Hungary", - "6": "Latvia", - "7": "Lithuania", - "8": "Poland", - "9": "Slovakia", - "10": "Bulgaria", - "11": "Romania", - "12": "Ireland", - "13": "Other EU Economic Area (EEA country)", - "14": "Any other country", - "15": "Prefer not to say" - } - } - } - }, - "tenant_economic_status": { - "header": "", - "description": "", - "questions": { - "person_1_economic_status": { - "check_answer_label": "Work", - "header": "Which of these best describes the tenant's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - } - } - }, - "household_number_of_other_members": { - "header": "", - "description": "", - "questions": { - "household_number_of_other_members": { - "check_answer_label": "Number of Other Household Members", - "header": "How many other people are there in the household?", - "hint_text": "The maximum number of others is 7", - "type": "numeric", - "min": 0, - "max": 7, - "step": 1, - "conditional_for": { - "person_2_relationship": ">0", - "person_2_age": ">0", - "person_2_gender": ">0", - "person_2_economic_status": ">0", - "person_3_relationship": ">1", - "person_3_age": ">1", - "person_3_gender": ">1", - "person_3_economic_status": ">1", - "person_4_relationship": ">2", - "person_4_age": ">2", - "person_4_gender": ">2", - "person_4_economic_status": ">2", - "person_5_relationship": ">3", - "person_5_age": ">3", - "person_5_gender": ">3", - "person_5_economic_status": ">3", - "person_6_relationship": ">4", - "person_6_age": ">4", - "person_6_gender": ">4", - "person_6_economic_status": ">4", - "person_7_relationship": ">5", - "person_7_age": ">5", - "person_7_gender": ">5", - "person_7_economic_status": ">5", - "person_8_relationship": ">6", - "person_8_age": ">6", - "person_8_gender": ">6", - "person_8_economic_status": ">6" - } - }, - "person_2_relationship": { - "check_answer_label": "Person 2's relationship to lead tenant", - "header": "What's person 2's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_2_age": { - "check_answer_label": "Person 2's age", - "header": "What's person 2's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_2_gender": { - "check_answer_label": "Person 2's gender", - "header": "Which of these best describes person 2's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_2_economic_status": { - "check_answer_label": "Person 2's Work", - "header": "Which of these best describes person 2's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_3_relationship": { - "check_answer_label": "Person 3's relationship to lead tenant", - "header": "What's person 3's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_3_age": { - "check_answer_label": "Person 3's age", - "header": "What's person 3's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_3_gender": { - "check_answer_label": "Person 3's gender", - "header": "Which of these best describes person 3's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_3_economic_status": { - "check_answer_label": "Person 3's Work", - "header": "Which of these best describes person 3's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_4_relationship": { - "check_answer_label": "Person 4's relationship to lead tenant", - "header": "What's person 4's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_4_age": { - "check_answer_label": "Person 4's age", - "header": "What's person 4's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_4_gender": { - "check_answer_label": "Person 4's gender", - "header": "Which of these best describes person 4's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_4_economic_status": { - "check_answer_label": "Person 4's Work", - "header": "Which of these best describes person 4's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_5_relationship": { - "check_answer_label": "Person 5's relationship to lead tenant", - "header": "What's person 5's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_5_age": { - "check_answer_label": "Person 5's age", - "header": "What's person 5's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_5_gender": { - "check_answer_label": "Person 5's gender", - "header": "Which of these best describes person 5's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_5_economic_status": { - "check_answer_label": "Person 5's Work", - "header": "Which of these best describes person 5's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_6_relationship": { - "check_answer_label": "Person 6's relationship to lead tenant", - "header": "What's person 6's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_6_age": { - "check_answer_label": "Person 6's age", - "header": "What's person 6's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_6_gender": { - "check_answer_label": "Person 6's gender", - "header": "Which of these best describes person 6's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_6_economic_status": { - "check_answer_label": "Person 6's Work", - "header": "Which of these best describes person 6's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_7_relationship": { - "check_answer_label": "Person 7's relationship to lead tenant", - "header": "What's person 7's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_7_age": { - "check_answer_label": "Person 7's age", - "header": "What's person 7's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_7_gender": { - "check_answer_label": "Person 7's gender", - "header": "Which of these best describes person 7's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_7_economic_status": { - "check_answer_label": "Person 7's Work", - "header": "Which of these best describes person 7's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - }, - "person_8_relationship": { - "check_answer_label": "Person 8's relationship to lead tenant", - "header": "What's person 8's relationship to lead tenant", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Partner", - "1": "Child - includes young adult and grown-up", - "2": "Other", - "3": "Prefer not to say" - } - }, - "person_8_age": { - "check_answer_label": "Person 8's age", - "header": "What's person 8's age", - "hint_text": "", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - }, - "person_8_gender": { - "check_answer_label": "Person 8's gender", - "header": "Which of these best describes person 8's gender identity?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Female", - "1": "Male", - "2": "Non-binary", - "3": "Prefer not to say" - } - }, - "person_8_economic_status": { - "check_answer_label": "Person 8's Work", - "header": "Which of these best describes person 8's working situation?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Part-time - Less than 30 hours", - "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", - "10": "Prefer not to say" - } - } - } - } - } - }, - "household_situation": { - "label": "Household situation", - "pages": { - "previous_housing_situation": { - "header": "", - "description": "", - "questions": { - "previous_housing_situation": { - "header": "What was the tenant’s housing situation immediately before this letting?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Owner occupation (private) ", - "1": "Owner occupation (low cost home ownership)", - "2": "Private sector tenancy", - "3": "Tied housing or rented with job", - "4": "Supported housing", - "5": "Sheltered accomodation", - "6": "Residential care home", - "7": "Living with friends or family", - "8": "Refuge", - "9": "Hospital", - "10": "Prison / approved probation hostel", - "11": "Direct access hostel", - "12": "Bed & Breakfast", - "13": "Mobile home / caravan", - "14": "Any other temporary accommodation", - "15": "Home Office Asylum Support", - "16": "Children’s home / foster care", - "17": "Rough sleeping", - "18": "Other", - "19": "Fixed term Local Authority General Needs tenancy", - "20": "Lifetime Local Authority General Needs tenancy", - "21": "Fixed term PRP General Needs tenancy", - "22": "Lifetime PRP General Needs tenancy" - } - } - } - }, - "homelessness": { - "header": "", - "description": "", - "questions": { - "homelessness": { - "header": "Did the tenant experience homelessness immediately before this letting?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes - assessed as homeless by a local authority and owed a homelessness duty. Including if threatened with homelessness within 56 days", - "1": "Yes - other homelessness ", - "2": "No" - } - } - } - }, - "reason_for_leaving_last_settled_home": { - "header": "Leaving their last settled home", - "description": "", - "questions": { - "reason_for_leaving_last_settled_home": { - "header": "What is the tenant’s main reason for leaving?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Permanently decanted from another property owned by this landlord", - "1": "Left home country as a refugee", - "2": "Loss of tied accommodation", - "3": "Domestic abuse", - "4": "(Non violent) relationship breakdown with partner", - "5": "Asked to leave by family or friends", - "6": "Racial harassment", - "7": "Other problems with neighbours", - "8": "Property unsuitable because of overcrowding", - "9": "End of assured shorthold tenancy - no fault", - "10": "End of assured shorthold tenancy - tenant's fault", - "11": "End of fixed term tenancy - no fault", - "12": "End of fixed term tenancy - tenant's fault", - "13": "Repossession", - "14": "Under occupation - offered incentive to downsize", - "15": "Under occupation - no incentive", - "16": "Property unsuitable because of ill health / disability", - "17": "Property unsuitable because of poor condition", - "18": "Couldn't afford fees attached to renewing the tenancy", - "19": "Couldn't afford increase in rent", - "20": "Couldn't afford rent or mortgage - welfare reforms", - "21": "Couldn't afford rent or mortgage - employment", - "22": "Couldn't afford rent or mortgage - other", - "23": "To move nearer to family / friends / school", - "24": "To move nearer to work", - "25": "To move to accomodation with support", - "26": "To move to independent accomodation", - "27": "Hate crime", - "28": "Death of household member in last settled accomodation", - "29": "Discharged from prison", - "30": "Discharged from long stay hospital or similar institution", - "31": "Other", - "32": "Do not know", - "33": "Prefer not to say" - }, - "conditional_for": { - "other_reason_for_leaving_last_settled_home": ["Other"] - } - }, - "other_reason_for_leaving_last_settled_home": { - "header": "Please state the reason for leaving last settled home", - "hint_text": "", - "type": "text" - }, - "benefit_cap_spare_room_subsidy": { - "header": "Was the reason for leaving because of the benefit cap or removal of the spare room subsidy?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes - benefit cap", - "1": "Yes - removal of the spare room subsidy", - "2": "Yes - both the benefit cap and the removal of the spare room subsidy", - "3": "No", - "4": "Do not know", - "5": "Prefer not to say" - } - } - } - } - } - }, - "household_needs": { - "label": "Household needs", - "pages": { - "armed_forces": { - "header": "Experience of the UK Armed Forces", - "description": "", - "questions": { - "armed_forces": { - "header": "Has the tenant ever served in the UK armed forces?", - "hint_text": "", - "type": "radio", - "check_answer_label": "Armed Forces", - "answer_options": { - "0": "Yes - a regular", - "1": "Yes - a reserve", - "2": "No", - "3": "Prefer not to say" - }, - "conditional_for": { - "armed_forces_active": ["Yes - a regular", "Yes - a reserve"], - "armed_forces_injured": ["Yes - a regular", "Yes - a reserve"] - } - }, - "armed_forces_active": { - "header": "Are they still serving?", - "hint_text": "", - "type": "radio", - "check_answer_label": "When did they leave the Armed Forces?", - "answer_options": { - "0": "Yes", - "1": "No - they left up to 5 years ago", - "2": "No - they left more than 5 years ago", - "3": "Prefer not to say" - } - }, - "armed_forces_injured": { - "header": "Were they seriously injured or ill as a result of their service?", - "hint_text": "", - "type": "radio", - "check_answer_label": "Has anyone in the household been seriously injured or ill as a result of their service in the armed forces?", - "answer_options": { - "0": "Yes", - "1": "No", - "2": "Prefer not to say" - } - }, - "armed_forces_partner": { - "header": "Was the tenant the spouse or civil partner of someone who served in the UK armed forces?", - "hint_text": "", - "type": "radio", - "check_answer_label": "Was the tenant the spouse or civil partner of someone who served in the UK armed forces?", - "answer_options": { - "0": "Yes - was the spouse or civil partner of a UK Armed Forces member and have separated within the last 2 years", - "1": "Yes - was the spouse or civil partner of a UK Armed Forces member who died within the last 2 years", - "2": "No", - "3": "Prefer not to say" - } - } - } - }, - "medical_conditions": { - "header": "", - "description": "", - "questions": { - "medical_conditions": { - "header": "Does anyone in the household have any of the following that they expect to last for 12 months or more:", - "hint_text": "", - "type": "radio", - "check_answer_label": "Physical, mental health or illness in the household", - "answer_options": { - "0": "Yes", - "1": "No", - "2": "Do not know", - "3": "Prefer not to say" - } - } - } - }, - "pregnancy": { - "header": "", - "description": "", - "questions": { - "pregnancy": { - "header": "Is anyone in the household pregnant?", - "hint_text": "", - "type": "radio", - "check_answer_label": "Pregnancy in the household", - "answer_options": { - "0": "Yes", - "1": "No", - "2": "Prefer not to say" - } - } - } - }, - "accessibility_requirements": { - "header": "", - "description": "", - "questions": { - "accessibility_requirements": { - "header": "Are any of these affected by their condition or illness?", - "hint_text": "Select all that apply", - "type": "checkbox", - "check_answer_label": "Disability requirements", - "answer_options": { - "accessibility_requirements_fully_wheelchair_accessible_housing": "Fully wheelchair accessible housing", - "accessibility_requirements_wheelchair_access_to_essential_rooms": "Wheelchair access to essential rooms", - "accessibility_requirements_level_access_housing": "Level access housing", - "accessibility_requirements_other_disability_requirements": "Other disability requirements", - "accessibility_requirements_no_disability_requirements": "No disability requirements", - "divider_a": true, - "accessibility_requirements_do_not_know": "Do not know", - "divider_b": true, - "accessibility_requirements_prefer_not_to_say": "Prefer not to say" - } - } - } - }, - "condition_effects": { - "header": "", - "description": "", - "questions": { - "condition_effects": { - "header": "Are any of these affected by their condition or illness?", - "hint_text": "Select all that apply", - "type": "checkbox", - "check_answer_label": "Conditions or illnesses", - "answer_options": { - "condition_effects_vision": "Vision - such as blindness or partial sight", - "condition_effects_hearing": "Hearing - such as deafness or partial hearing", - "condition_effects_mobility": "Mobility - such as walking short distances or climbing stairs", - "condition_effects_dexterity": "Dexterity - such as lifting and carrying objects or using a keyboard", - "condition_effects_stamina": "Stamina or breathing or fatigue", - "condition_effects_learning": "Learning or understanding or concentrating", - "condition_effects_memory": "Memory", - "condition_effects_mental_health": "Mental health - such as depression, anxiety, schizophrenia or bipolar", - "condition_effects_social_or_behavioral": "Socially or behaviourally - such as those associated with autism spectral disorder (ASD) including Aspergers’ or attention deficit hyperactivity disorder (ADHD))", - "condition_effects_other": "Other", - "divider": true, - "condition_effects_prefer_not_to_say": "Prefer not to say" - } - } - } - } - } - } - } - }, - "tenancy_and_property": { - "label": "Tenancy and property information", - "subsections": { - "tenancy_information": { - "label": "Tenancy information", - "pages": { - "tenancy_code": { - "header": "", - "description": "", - "questions": { - "tenancy_code": { - "check_answer_label": "What is the tenancy code?", - "header": "What is the tenancy code?", - "hint_text": "", - "type": "text" - } - } - }, - "tenancy_start_date": { - "header": "", - "description": "", - "questions": { - "tenancy_start_date": { - "check_answer_label": "When is the tenancy start date?", - "header": "What is the tenancy start date?", - "hint_text": "For example, 27 3 2007", - "type": "date" - } - } - }, - "starter_tenancy": { - "header": "", - "description": "", - "questions": { - "starter_tenancy": { - "check_answer_label": "Is this a starter or introductory tenancy?", - "header": "Is this a starter tenancy?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - }, - "fixed_term_tenancy": { - "header": "", - "description": "", - "questions": { - "fixed_term_tenancy": { - "check_answer_label": "If the main tenancy is a fixed term tenancy, please provide the length of the fixed term (to the nearest year) excluding any starter/introductory period", - "header": "If fixed-term, what is the length of the fixed-term tenancy after any starter period?", - "hint_text": "To the nearest year", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - } - } - }, - "tenancy_type": { - "header": "", - "description": "", - "questions": { - "tenancy_type": { - "check_answer_label": "Type of main tenancy (after any starter/introductory period)", - "header": "What is the type of tenancy after the starter period has ended?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Fixed term – Secure", - "1": "Fixed term – Assured Shorthold Tenancy (AST)", - "2": "Lifetime – Secure", - "3": "Lifetime – Assured", - "4": "License agreement", - "5": "Other" - }, - "conditional_for": { - "other_tenancy_type": ["Other"] - } - }, - "other_tenancy_type": { - "header": "Please state the tenancy type", - "hint_text": "", - "type": "text" - } - } - }, - "letting_type": { - "header": "", - "description": "", - "questions": { - "letting_type": { - "check_answer_label": "Type of letting", - "header": "Which type of letting is this?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Social Rent - General Needs", - "1": "Social Rent - Supporting Housing", - "2": "Affordable Rent - General Needs", - "3": "Affordable Rent - Supporting Housing", - "4": "Rent To Buy - General Needs", - "5": "Rent To Buy - Supported Housing" - } - } - } - }, - "letting_provider": { - "header": "", - "description": "", - "questions": { - "letting_provider": { - "check_answer_label": "Provider", - "header": "Who is the letting provider?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "This landlord", - "1": "Another registered provider - includes housing association or local authority" - } - } - } - } - } - }, - "property_information": { - "label": "Property information", - "pages": { - "property_location": { - "header": "", - "description": "", - "questions": { - "property_location": { - "check_answer_label": "Property Location", - "header": "Property location", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Adur", - "1": "Allerdale", - "2": "Amber Valley", - "3": "Arun", - "4": "Ashfield", - "5": "Ashford", - "6": "Babergh", - "7": "Barking & Dagenham", - "8": "Barnet", - "9": "Barnsley", - "10": "Barrow-in-Furness", - "11": "Basildon", - "12": "Basingstoke & Deane", - "13": "Bassetlaw", - "14": "Bath & NE Somerset", - "15": "Bedford Borough Council", - "16": "Bexley", - "17": "Birmingham", - "18": "Blaby", - "19": "Blackburn", - "20": "Blackpool", - "21": "Bolsover", - "22": "Bolton", - "23": "Boston", - "24": "Bournemouth & Christchurch & Poole", - "25": "Bracknell Forest", - "26": "Bradford", - "27": "Braintree", - "28": "Breckland", - "29": "Brent", - "30": "Brentwood", - "31": "Brighton & Hove", - "32": "Bristol", - "33": "Broadland", - "34": "Bromley", - "35": "Bromsgrove", - "36": "Broxbourne", - "37": "Broxtowe", - "38": "Buckinghamshire", - "39": "Burnley", - "40": "Bury", - "41": "Calderdale", - "42": "Cambridge", - "43": "Camden", - "44": "Cannock Chase", - "45": "Canterbury", - "46": "Carlisle", - "47": "Castle Point", - "48": "Central Bedfordshire", - "49": "Charnwood", - "50": "Chelmsford", - "51": "Cheltenham", - "52": "Cherwell", - "53": "Cheshire West & Chester", - "54": "Chesterfield", - "55": "Chichester", - "56": "Chorley", - "57": "City of London", - "58": "Colchester", - "59": "Copeland", - "60": "Cornwall", - "61": "Cotswold", - "62": "Coventry", - "63": "Craven", - "64": "Crawley", - "65": "Croydon", - "66": "Dacorum", - "67": "Darlington", - "68": "Dartford", - "69": "Derby", - "70": "Derbyshire Dales", - "71": "Doncaster", - "72": "Dorset", - "73": "Dover", - "74": "Dudley", - "75": "Durham", - "76": "Ealing", - "77": "East Cambridgeshire", - "78": "East Cheshire", - "79": "East Devon", - "80": "East Hampshire", - "81": "East Herts", - "82": "East Lindsey", - "83": "East Riding", - "84": "East Staffordshire", - "85": "East Suffolk", - "86": "Eastbourne", - "87": "Eastleigh", - "88": "Eden", - "89": "Elmbridge", - "90": "Enfield", - "91": "Epping Forest", - "92": "Epsom & Ewell", - "93": "Erewash", - "94": "Exeter", - "95": "Fareham", - "96": "Fenland", - "97": "Folkestone & Hythe", - "98": "Forest of Dean", - "99": "Fylde", - "100": "Gateshead", - "101": "Gedling", - "102": "Gloucester", - "103": "Gosport", - "104": "Gravesham", - "105": "Great Yarmouth", - "106": "Greenwich", - "107": "Guildford", - "108": "Hackney", - "109": "Halton", - "110": "Hambleton", - "111": "Hammersmith & Fulham", - "112": "Harborough", - "113": "Haringey", - "114": "Harlow", - "115": "Harrogate", - "116": "Harrow", - "117": "Hart", - "118": "Hartlepool", - "119": "Hastings", - "120": "Havant", - "121": "Havering", - "122": "Herefordshire", - "123": "Hertsmere", - "124": "High Peak", - "125": "Hillingdon", - "126": "Hinckley & Bosworth", - "127": "Horsham", - "128": "Hounslow", - "129": "Huntingdonshire", - "130": "Hyndburn", - "131": "Ipswich", - "132": "Isle of Wight", - "133": "Isles of Scilly", - "134": "Islington", - "135": "Kensington & Chelsea", - "136": "Kings Lynn & West Norfolk", - "137": "Kingston-upon-Hull", - "138": "Kingston-upon-Thames", - "139": "Kirklees", - "140": "Knowsley", - "141": "Lambeth", - "142": "Lancaster", - "143": "Leeds", - "144": "Leicester", - "145": "Lewes", - "146": "Lewisham", - "147": "Lichfield", - "148": "Lincoln", - "149": "Liverpool", - "150": "Luton", - "151": "Maidstone", - "152": "Maldon", - "153": "Malvern Hills", - "154": "Manchester", - "155": "Mansfield", - "156": "Medway", - "157": "Melton", - "158": "Mendip", - "159": "Merton", - "160": "Mid Devon", - "161": "Mid Suffolk", - "162": "Mid Sussex", - "163": "Middlesbrough", - "164": "Milton Keynes", - "165": "Mole Valley", - "166": "N. Ireland", - "167": "New Forest", - "168": "Newark", - "169": "Newcastle-under-Lyme", - "170": "Newcastle-upon-Tyne", - "171": "Newham", - "172": "North Devon", - "173": "North East Derbyshire", - "174": "North East Lincolnshire", - "175": "North Hertfordshire", - "176": "North Kesteven", - "177": "North Lincolnshire", - "178": "North Norfolk", - "179": "North Northamptonshire", - "180": "North Somerset", - "181": "North Tyneside", - "182": "North Warwickshire", - "183": "North West Leics", - "184": "Northumberland", - "185": "Norwich", - "186": "Nottingham", - "187": "Nuneaton & Bedworth", - "188": "Oadby & Wigston", - "189": "Oldham", - "190": "Outside UK", - "191": "Oxford", - "192": "Pendle", - "193": "Peterborough", - "194": "Plymouth", - "195": "Portsmouth", - "196": "Preston", - "197": "Reading", - "198": "Redbridge", - "199": "Redcar & Cleveland", - "200": "Redditch", - "201": "Reigate & Banstead", - "202": "Ribble Valley", - "203": "Richmond-upon-Thames", - "204": "Richmondshire", - "205": "Rochdale", - "206": "Rochford", - "207": "Rossendale", - "208": "Rother", - "209": "Rotherham", - "210": "Rugby", - "211": "Runnymede", - "212": "Rushcliffe", - "213": "Rushmoor", - "214": "Rutland", - "215": "Ryedale", - "216": "Salford", - "217": "Sandwell", - "218": "Scarborough", - "219": "Scotland", - "220": "Sedgemoor", - "221": "Sefton", - "222": "Selby", - "223": "Sevenoaks", - "224": "Sheffield", - "225": "Shropshire", - "226": "Slough", - "227": "Solihull", - "228": "Somerset West & Taunton", - "229": "South Cambridgeshire", - "230": "South Derbyshire", - "231": "South Gloucestershire", - "232": "South Hams", - "233": "South Holland", - "234": "South Kesteven", - "235": "South Lakeland", - "236": "South Norfolk", - "237": "South Oxfordshire", - "238": "South Ribble", - "239": "South Somerset", - "240": "South Staffordshire", - "241": "South Tyneside", - "242": "Southampton", - "243": "Southend-on-Sea", - "244": "Southwark", - "245": "Spelthorne", - "246": "St Albans", - "247": "St Helens", - "248": "Stafford", - "249": "Staffordshire Moorlands", - "250": "Stevenage", - "251": "Stockport", - "252": "Stockton-on-Tees", - "253": "Stoke-on-Trent", - "254": "Stratford-on-Avon", - "255": "Stroud", - "256": "Sunderland", - "257": "Surrey Heath", - "258": "Sutton", - "259": "Swale", - "260": "Swindon", - "261": "Tameside", - "262": "Tamworth", - "263": "Tandridge", - "264": "Teignbridge", - "265": "Telford & Wrekin", - "266": "Tendring", - "267": "Test Valley", - "268": "Tewkesbury", - "269": "Thanet", - "270": "Three Rivers", - "271": "Thurrock", - "272": "Tonbridge & Malling", - "273": "Torbay", - "274": "Torridge", - "275": "Tower Hamlets", - "276": "Trafford", - "277": "Tunbridge Wells", - "278": "Uttlesford", - "279": "Vale of White Horse", - "280": "Wakefield", - "281": "Wales", - "282": "Walsall", - "283": "Waltham Forest", - "284": "Wandsworth", - "285": "Warrington", - "286": "Warwick", - "287": "Watford", - "288": "Waverley", - "289": "Wealden", - "290": "Welwyn Hatfield", - "291": "West Berkshire", - "292": "West Devon", - "293": "West Lancashire", - "294": "West Lindsey", - "295": "West Northamptonshire", - "296": "West Oxfordshire", - "297": "West Suffolk", - "298": "Westminster", - "299": "Wigan", - "300": "Wiltshire", - "301": "Winchester", - "302": "Windsor & Maidenhead", - "303": "Wirral", - "304": "Woking", - "305": "Wokingham", - "306": "Wolverhampton", - "307": "Worcester", - "308": "Worthing", - "309": "Wychavon", - "310": "Wyre", - "311": "Wyre Forest", - "312": "York" - } - } - } - }, - "property_postcode": { - "header": "", - "description": "", - "questions": { - "property_postcode": { - "check_answer_label": "What was the previous postcode?", - "header": "What is the property's postcode?", - "hint_text": "", - "type": "text" - } - } - }, - "property_relet": { - "header": "", - "description": "", - "questions": { - "property_relet": { - "check_answer_label": "Which type was the property most recently let as?", - "header": "Is this property a relet?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - }, - "property_vacancy_reason": { - "header": "", - "description": "", - "questions": { - "property_vacancy_reason": { - "check_answer_label": "What is the reason for the property vacancy?", - "header": "What is the reason for the property vacancy?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "First let of newbuild property", - "1": "First let of conversion/rehabilitation/acquired property", - "2": "First let of leased property", - "3": "Relet - tenant evicted due to arrears", - "4": "Relet - tenant evicted due to ASB or other reason", - "5": "Relet - tenant died (no succession)", - "6": "Relet - tenant moved to other social housing provider", - "7": "Relet - tenant abandoned property", - "8": "Relet - tenant moved to private sector or other accommodation", - "9": "Relet - to tenant who occupied same property as temporary accommodation", - "10": "Relet – internal transfer (excluding renewals of a fixed-term tenancy)", - "11": "Relet – renewal of fixed-term tenancy", - "12": "Relet – tenant moved to care home", - "13": "Relet – tenant involved in a succession downsize" - } - } - } - }, - "property_reference": { - "header": "", - "description": "", - "questions": { - "property_reference": { - "check_answer_label": "What’s the property reference?", - "header": "What's the property reference?", - "hint_text": "", - "type": "text" - } - } - }, - "property_unit_type": { - "header": "", - "description": "", - "questions": { - "property_unit_type": { - "check_answer_label": "Which type of unit is the property?", - "header": "Which type of unit is the property?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Flat / maisonette", - "1": "Bed-sit", - "2": "House", - "3": "Bungalow", - "4": "Shared flat / maisonette", - "5": "Shared house", - "6": "Shared bungalow", - "7": "Other" - } - } - } - }, - "property_number_of_bedrooms": { - "header": "", - "description": "", - "questions": { - "property_number_of_bedrooms": { - "check_answer_label": "How many bedrooms are there in the property?", - "header": "How many bedrooms are there in the property?", - "hint_text": "If shared accommodation, enter number of bedrooms occupied by this household; a bed-sit has 1 bedroom", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - } - } - }, - "property_major_repairs": { - "header": "", - "description": "", - "questions": { - "property_major_repairs": { - "check_answer_label": "Were major repairs carried out during the void period?", - "header": "Were any major repairs completed during the void period?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" + "type": "object", + "patternProperties": { + "[a-z_]+": { + "description": "", + "type": "object", + "properties": { + "label": { + "description": "", + "type": "string" + }, + "subsections": { + "type": "object", + "patternProperties": { + "[a-z_]+": { + "description": "", + "type": "object", + "required": ["label"], + "properties": { + "label": { + "description": "", + "type": "string" }, - "conditional_for": { - "property_major_repairs_date": ["Yes"] - } - }, - "property_major_repairs_date": { - "check_answer_label": "What was the major repairs completion date?", - "header": "What was the major repairs completion date?", - "hint_text": "For example, 27 3 2007", - "type": "date" - } - } - }, - "property_number_of_times_relet": { - "header": "", - "description": "", - "questions": { - "property_number_of_times_relet": { - "check_answer_label": "How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let?", - "header": "How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let? ", - "hint_text": "For an Affordable Rent or Intermediate Rent Letting, only include number of offers as that type. For a property let at the first attempt enter '0' ", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 - } - } - }, - "property_wheelchair_accessible": { - "header": "", - "description": "", - "questions": { - "property_wheelchair_accessible": { - "check_answer_label": "Is property built or adapted to wheelchair user standards?", - "header": "Is property built or adapted to wheelchair user standards?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - } + "pages": { + "type": "object", + "patternProperties": { + "[a-z_]+": { + "description": "", + "type": "object", + "properties": { + "header": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "questions": { + "type": "object", + "patternProperties": { + "[a-z_]+": { + "description": "", + "type": "object", + "required": ["header", "check_answer_label"], + "properties": { + "check_answer_label": { + "description": "", + "type": "string" + }, + "header": { + "description": "", + "type": "string" + }, + "type": { + "description": "", + "type": "string" + }, + "hint_text": { + "description": "", + "type": "string" + }, + "answer_options": { + "description": "", + "type": "object" + }, + "conditional_for": { + "description": "", + "type": "object" + } + } + } + } + } + }, + "minProperties": 1 + } + } + } + }, + "minProperties": 1 + } + } } - } + }, + "minProperties": 2 } }, - "rent_and_charges": { - "label": "Rent and charges", - "subsections": { - "income_and_benefits": { - "label": "Income and benefits", - "pages": { - "net_income": { - "header": "", - "description": "", - "questions": { - "net_income_known": { - "check_answer_label": "Income known", - "header": "Do you know the tenant and their partner's net income?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No", - "2": "Tenant prefers not to say" - }, - "conditional_for": { - "net_income": ["Yes"], - "net_income_frequency": ["Yes"] - } - }, - "net_income": { - "check_answer_label": "Income", - "header": "What is the tenant’s /and partner’s combined income after tax?", - "hint_text": "", - "type": "numeric", - "min": 0, - "step": "1" - }, - "net_income_frequency": { - "check_answer_label": "Income Frequency", - "header": "How often do they receive this income?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Weekly", - "1": "Monthly", - "2": "Yearly" - } - } - }, - "soft_validations": { - "override_net_income_validation": { - "check_answer_label": "Net income confirmed?", - "type": "validation_override", - "answer_options": { - "override_net_income_validation": "Yes" - } - } - } - }, - "net_income_uc_proportion": { - "header": "", - "description": "", - "questions": { - "net_income_uc_proportion": { - "check_answer_label": "Benefits as a proportion of income", - "header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "All", - "1": "Some", - "2": "None", - "3": "Do not know" - } - } - } - }, - "housing_benefit": { - "header": "", - "description": "", - "questions": { - "housing_benefit": { - "check_answer_label": "Universal Credit & Housing Benefit\t", - "header": "Is the tenant likely to be in receipt of any of these housing-related benefits?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Housing Benefit, but not Universal Credit", - "1": "Universal Credit with housing element, but not Housing Benefit", - "2": "Universal Credit without housing element and no Housing Benefit", - "3": "Universal Credit and Housing Benefit", - "4": "Not Housing Benefit or Universal Credit", - "5": "Do not know", - "6": "Prefer not to say" - } - } - } - } - } - }, - "rent": { - "label": "Rent", - "pages": { - "rent": { - "header": "", - "description": "", - "questions": { - "rent_frequency": { - "check_answer_label": "Rent Period", - "header": "Which period are rent and other charges due?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Weekly for 52 weeks", - "1": "Fortnightly", - "2": "Four-weekly", - "3": "Calendar monthly", - "4": "Weekly for 50 weeks", - "5": "Weekly for 49 weeks", - "6": "Weekly for 48 weeks", - "7": "Weekly for 47 weeks", - "8": "Weekly for 46 weeks", - "9": "Weekly for 53 weeks" - } - }, - "basic_rent": { - "check_answer_label": "Basic Rent", - "header": "What is the basic rent?", - "hint_text": "Eligible for housing benefit or Universal Credit", - "type": "numeric", - "min": 0, - "step": 1, - "fields-to-add": ["basic_rent", "service_charge", "personal_service_charge", "support_charge"], - "result-field": "total_charge" - }, - "service_charge": { - "check_answer_label": "Service Charge", - "header": "What is the service charge?", - "hint_text": "Eligible for housing benefit or Universal Credit", - "type": "numeric", - "min": 0, - "step": 1, - "fields-to-add": ["basic_rent", "service_charge", "personal_service_charge", "support_charge"], - "result-field": "total_charge" - }, - "personal_service_charge": { - "check_answer_label": "Personal Service Charge", - "header": "What is the personal service charge?", - "hint_text": "Not eligible for housing benefit or Universal Credit. For example, hot water excluding water rates.", - "type": "numeric", - "min": 0, - "step": 1, - "fields-to-add": ["basic_rent", "service_charge", "personal_service_charge", "support_charge"], - "result-field": "total_charge" - }, - "support_charge": { - "check_answer_label": "Support Charge", - "header": "What is the support charge?", - "hint_text": "This is to fund housing-related support services included in the tenancy agreement", - "type": "numeric", - "min": 0, - "step": 1, - "fields-to-add": ["basic_rent", "service_charge", "personal_service_charge", "support_charge"], - "result-field": "total_charge" - }, - "total_charge": { - "check_answer_label": "Total Charge", - "header": "Total charge?", - "hint_text": "This is the total of rent and all charges", - "type": "numeric", - "min": 0, - "step": 1, - "readonly": true - }, - "outstanding_rent_or_charges": { - "check_answer_label": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?", - "header": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - }, - "conditional_for": { - "outstanding_amount": ["Yes"] - } - }, - "outstanding_amount": { - "check_answer_label": "Outstanding amount", - "header": "What do you expect the amount to be?", - "hint_text": "If the amount is unknown you can estimate", - "type": "numeric", - "min": 0, - "step": 1 - } - } - } - } - } - } - }, - "local_authority": { - "label": "Local authority", - "subsections": { - "local_authority": { - "label": "Local authority", - "pages": { - "time_lived_in_la": { - "header": "", - "description": "", - "questions": { - "time_lived_in_la": { - "check_answer_label": "How long has the household continuously lived in the local authority area where the new letting is located?", - "header": "How long has the household continuously lived in the local authority area where the new letting is located?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Just moved to local authority area", - "1": "Less than 1 year", - "2": "1 to 2 years", - "3": "2 to 3 years", - "4": "3 to 4 years", - "5": "4 to 5 years", - "6": "5 years or more", - "7": "Do not know" - } - } - } - }, - "time_on_la_waiting_list": { - "header": "", - "description": "", - "questions": { - "time_on_la_waiting_list": { - "check_answer_label": "How long has the household been on the local authority waiting list where the new letting is located?", - "header": "How long has the household been on the local authority waiting list where the new letting is located?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Just moved to local authority area", - "1": "Less than 1 year", - "2": "1 to 2 years", - "3": "2 to 3 years", - "4": "3 to 4 years", - "5": "4 to 5 years", - "6": "5 years or more", - "7": "Do not know" - } - } - } - }, - "previous_la": { - "header": "", - "description": "", - "questions": { - "previous_la": { - "check_answer_label": "The LA in which household lived immediately before this letting\t", - "header": "Which local authority area did the household live in immediately before this letting?", - "hint_text": "Includes temporary accommodation", - "type": "radio", - "answer_options": { - "0": "Adur", - "1": "Allerdale", - "2": "Amber Valley", - "3": "Arun", - "4": "Ashfield", - "5": "Ashford", - "6": "Babergh", - "7": "Barking & Dagenham", - "8": "Barnet", - "9": "Barnsley", - "10": "Barrow-in-Furness", - "11": "Basildon", - "12": "Basingstoke & Deane", - "13": "Bassetlaw", - "14": "Bath & NE Somerset", - "15": "Bedford Borough Council", - "16": "Bexley", - "17": "Birmingham", - "18": "Blaby", - "19": "Blackburn", - "20": "Blackpool", - "21": "Bolsover", - "22": "Bolton", - "23": "Boston", - "24": "Bournemouth & Christchurch & Poole", - "25": "Bracknell Forest", - "26": "Bradford", - "27": "Braintree", - "28": "Breckland", - "29": "Brent", - "30": "Brentwood", - "31": "Brighton & Hove", - "32": "Bristol", - "33": "Broadland", - "34": "Bromley", - "35": "Bromsgrove", - "36": "Broxbourne", - "37": "Broxtowe", - "38": "Buckinghamshire", - "39": "Burnley", - "40": "Bury", - "41": "Calderdale", - "42": "Cambridge", - "43": "Camden", - "44": "Cannock Chase", - "45": "Canterbury", - "46": "Carlisle", - "47": "Castle Point", - "48": "Central Bedfordshire", - "49": "Charnwood", - "50": "Chelmsford", - "51": "Cheltenham", - "52": "Cherwell", - "53": "Cheshire West & Chester", - "54": "Chesterfield", - "55": "Chichester", - "56": "Chorley", - "57": "City of London", - "58": "Colchester", - "59": "Copeland", - "60": "Cornwall", - "61": "Cotswold", - "62": "Coventry", - "63": "Craven", - "64": "Crawley", - "65": "Croydon", - "66": "Dacorum", - "67": "Darlington", - "68": "Dartford", - "69": "Derby", - "70": "Derbyshire Dales", - "71": "Doncaster", - "72": "Dorset", - "73": "Dover", - "74": "Dudley", - "75": "Durham", - "76": "Ealing", - "77": "East Cambridgeshire", - "78": "East Cheshire", - "79": "East Devon", - "80": "East Hampshire", - "81": "East Herts", - "82": "East Lindsey", - "83": "East Riding", - "84": "East Staffordshire", - "85": "East Suffolk", - "86": "Eastbourne", - "87": "Eastleigh", - "88": "Eden", - "89": "Elmbridge", - "90": "Enfield", - "91": "Epping Forest", - "92": "Epsom & Ewell", - "93": "Erewash", - "94": "Exeter", - "95": "Fareham", - "96": "Fenland", - "97": "Folkestone & Hythe", - "98": "Forest of Dean", - "99": "Fylde", - "100": "Gateshead", - "101": "Gedling", - "102": "Gloucester", - "103": "Gosport", - "104": "Gravesham", - "105": "Great Yarmouth", - "106": "Greenwich", - "107": "Guildford", - "108": "Hackney", - "109": "Halton", - "110": "Hambleton", - "111": "Hammersmith & Fulham", - "112": "Harborough", - "113": "Haringey", - "114": "Harlow", - "115": "Harrogate", - "116": "Harrow", - "117": "Hart", - "118": "Hartlepool", - "119": "Hastings", - "120": "Havant", - "121": "Havering", - "122": "Herefordshire", - "123": "Hertsmere", - "124": "High Peak", - "125": "Hillingdon", - "126": "Hinckley & Bosworth", - "127": "Horsham", - "128": "Hounslow", - "129": "Huntingdonshire", - "130": "Hyndburn", - "131": "Ipswich", - "132": "Isle of Wight", - "133": "Isles of Scilly", - "134": "Islington", - "135": "Kensington & Chelsea", - "136": "Kings Lynn & West Norfolk", - "137": "Kingston-upon-Hull", - "138": "Kingston-upon-Thames", - "139": "Kirklees", - "140": "Knowsley", - "141": "Lambeth", - "142": "Lancaster", - "143": "Leeds", - "144": "Leicester", - "145": "Lewes", - "146": "Lewisham", - "147": "Lichfield", - "148": "Lincoln", - "149": "Liverpool", - "150": "Luton", - "151": "Maidstone", - "152": "Maldon", - "153": "Malvern Hills", - "154": "Manchester", - "155": "Mansfield", - "156": "Medway", - "157": "Melton", - "158": "Mendip", - "159": "Merton", - "160": "Mid Devon", - "161": "Mid Suffolk", - "162": "Mid Sussex", - "163": "Middlesbrough", - "164": "Milton Keynes", - "165": "Mole Valley", - "166": "N. Ireland", - "167": "New Forest", - "168": "Newark", - "169": "Newcastle-under-Lyme", - "170": "Newcastle-upon-Tyne", - "171": "Newham", - "172": "North Devon", - "173": "North East Derbyshire", - "174": "North East Lincolnshire", - "175": "North Hertfordshire", - "176": "North Kesteven", - "177": "North Lincolnshire", - "178": "North Norfolk", - "179": "North Northamptonshire", - "180": "North Somerset", - "181": "North Tyneside", - "182": "North Warwickshire", - "183": "North West Leics", - "184": "Northumberland", - "185": "Norwich", - "186": "Nottingham", - "187": "Nuneaton & Bedworth", - "188": "Oadby & Wigston", - "189": "Oldham", - "190": "Outside UK", - "191": "Oxford", - "192": "Pendle", - "193": "Peterborough", - "194": "Plymouth", - "195": "Portsmouth", - "196": "Preston", - "197": "Reading", - "198": "Redbridge", - "199": "Redcar & Cleveland", - "200": "Redditch", - "201": "Reigate & Banstead", - "202": "Ribble Valley", - "203": "Richmond-upon-Thames", - "204": "Richmondshire", - "205": "Rochdale", - "206": "Rochford", - "207": "Rossendale", - "208": "Rother", - "209": "Rotherham", - "210": "Rugby", - "211": "Runnymede", - "212": "Rushcliffe", - "213": "Rushmoor", - "214": "Rutland", - "215": "Ryedale", - "216": "Salford", - "217": "Sandwell", - "218": "Scarborough", - "219": "Scotland", - "220": "Sedgemoor", - "221": "Sefton", - "222": "Selby", - "223": "Sevenoaks", - "224": "Sheffield", - "225": "Shropshire", - "226": "Slough", - "227": "Solihull", - "228": "Somerset West & Taunton", - "229": "South Cambridgeshire", - "230": "South Derbyshire", - "231": "South Gloucestershire", - "232": "South Hams", - "233": "South Holland", - "234": "South Kesteven", - "235": "South Lakeland", - "236": "South Norfolk", - "237": "South Oxfordshire", - "238": "South Ribble", - "239": "South Somerset", - "240": "South Staffordshire", - "241": "South Tyneside", - "242": "Southampton", - "243": "Southend-on-Sea", - "244": "Southwark", - "245": "Spelthorne", - "246": "St Albans", - "247": "St Helens", - "248": "Stafford", - "249": "Staffordshire Moorlands", - "250": "Stevenage", - "251": "Stockport", - "252": "Stockton-on-Tees", - "253": "Stoke-on-Trent", - "254": "Stratford-on-Avon", - "255": "Stroud", - "256": "Sunderland", - "257": "Surrey Heath", - "258": "Sutton", - "259": "Swale", - "260": "Swindon", - "261": "Tameside", - "262": "Tamworth", - "263": "Tandridge", - "264": "Teignbridge", - "265": "Telford & Wrekin", - "266": "Tendring", - "267": "Test Valley", - "268": "Tewkesbury", - "269": "Thanet", - "270": "Three Rivers", - "271": "Thurrock", - "272": "Tonbridge & Malling", - "273": "Torbay", - "274": "Torridge", - "275": "Tower Hamlets", - "276": "Trafford", - "277": "Tunbridge Wells", - "278": "Uttlesford", - "279": "Vale of White Horse", - "280": "Wakefield", - "281": "Wales", - "282": "Walsall", - "283": "Waltham Forest", - "284": "Wandsworth", - "285": "Warrington", - "286": "Warwick", - "287": "Watford", - "288": "Waverley", - "289": "Wealden", - "290": "Welwyn Hatfield", - "291": "West Berkshire", - "292": "West Devon", - "293": "West Lancashire", - "294": "West Lindsey", - "295": "West Northamptonshire", - "296": "West Oxfordshire", - "297": "West Suffolk", - "298": "Westminster", - "299": "Wigan", - "300": "Wiltshire", - "301": "Winchester", - "302": "Windsor & Maidenhead", - "303": "Wirral", - "304": "Woking", - "305": "Wokingham", - "306": "Wolverhampton", - "307": "Worcester", - "308": "Worthing", - "309": "Wychavon", - "310": "Wyre", - "311": "Wyre Forest", - "312": "York" - } - } - } - }, - "previous_postcode": { - "header": "", - "description": "", - "questions": { - "previous_postcode": { - "check_answer_label": "Postcode of previous accomodation if the household has moved from settled accommodation", - "header": "Postcode for the previous accommodation", - "hint_text": "If the household has moved from settled accommodation immediately prior to being re-housed", - "type": "text" - } - } - }, - "reasonable_preference": { - "header": "", - "description": "", - "questions": { - "reasonable_preference": { - "check_answer_label": "Was the household given Reasonable Preference (i.e. priority) for housing by the Local Authority?", - "header": "Was the household given reasonable preference by the local authority?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - }, - "conditional_for": { - "reasonable_preference_reason": ["Yes"] - } - }, - "reasonable_preference_reason": { - "check_answer_label": "Reason for reasonable preference", - "header": "Why were they given reasonable preference?", - "hint_text": "Select all that apply", - "type": "checkbox", - "answer_options": { - "reasonable_preference_reason_homeless": "Homeless or about to lose their home (within 56 days)", - "reasonable_preference_reason_unsatisfactory_housing": "Living in insanitary or overcrowded or unsatisfactory housing", - "reasonable_preference_reason_medical_grounds": "A need to move on medical and welfare grounds (including a disability)", - "reasonable_preference_reason_avoid_hardship": "A need to move to avoid hardship to themselves or others", - "divider": true, - "reasonable_preference_reason_do_not_know": "Do not know" - } - } - } - }, - "lettings_policy": { - "header": "", - "description": "", - "questions": { - "cbl_letting": { - "check_answer_label": "Choice-based letting?", - "header": "Was the letting made under choice-based lettings (CBL)? ", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - }, - "chr_letting": { - "check_answer_label": "Common housing register letting?", - "header": "Was the letting made under common housing register (CHR)? ", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - }, - "cap_letting": { - "check_answer_label": "Common allocation policy letting?", - "header": "Was the letting made under common allocation policy (CAP)? ", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - } - } - } - } - }, - "submission": { - "label": "Submission", - "subsections": { - "declaration": { - "label": "Declaration", - "pages": { - "declaration": { - "header": "", - "description": "", - "questions": { - "declaration": { - "check_answer_label": "", - "header": "What is the tenant code?", - "hint_text": "", - "type": "text" - } - } - } - } - } - } - } + "minProperties": 1 } } - \ No newline at end of file +} \ No newline at end of file diff --git a/config/forms/schema/generic.json b/config/forms/schema/generic.json index 50c08369c..d7654e063 100644 --- a/config/forms/schema/generic.json +++ b/config/forms/schema/generic.json @@ -21,69 +21,97 @@ "sections": { "type": "object", "patternProperties": { - "[a-z_\/#]+": { - "description": "", - "type": "object" - }, - "properties": { - "label": { - "description": "", - "type": "string" - }, - "subsections": { - "description": "", - "type": "object", - "patternProperties": { - "[a-z_\/#]+": { - "description": "", - "type": "object", - "required": ["label"], - "properties": { - "label": { - "description": "", - "type": "string", - "required": "true" - }, - "pages": { - "type": "object", - "required": ["header"], - "patternProperties": { + "[a-z_]+": { + "description": "Section Name", + "type": "object", + "properties": { + "label": { + "description": "", + "type": "string" + }, + "subsections": { + "type": "object", + "patternProperties": { + "[a-z_]+": { + "description": "SubSection Name", + "type": "object", + "required": ["label"], + "properties": { + "label": { + "description": "", + "type": "string" + }, + "pages": { "type": "object", - "[a-z_]+": { - "properties": { - "header": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "questions": { - "type": "object", - "patternProperties": { + "patternProperties": { + "[a-z_]+": { + "description": "Page Name", + "type": "object", + "required": ["header", "questions"], + "properties": { + "header": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "questions": { "type": "object", - "[a-z_]+": { - "properties": { - "check_answer_label": { - "type": "string" - } + "patternProperties": { + "[a-z_]+": { + "description": "Question Name", + "type": "object", + "required": ["header", "type"], + "properties": { + "header": { + "description": "", + "type": "string" + }, + "type": { + "description": "", + "type": "string" + } + }, + "additionalProperties": { + "hint_text": { + "optional": "true", + "description": "", + "type": "string" + }, + "answer_options": { + "optional": "true", + "description": "", + "type": "object" + }, + "check_answer_label": { + "description": "", + "type": "string" + } + }, + "minProperties": 1 } } - }, - "minProperties": 8 + } }, - "minProperties": 8 + "additionalProperties": { + "conditional_route_to": { + "description": "", + "type": "object" + } + }, + "minProperties": 1 } - } - }, - "minProperties": 8 - } + } + } + }, + "minProperties": 1 } - } - }, - "minProperties": 8 - } + } + } + }, + "minProperties": 2 } }, "minProperties": 1 diff --git a/config/forms/schema/test.json b/config/forms/schema/test.json deleted file mode 100644 index 93eaf9a6d..000000000 --- a/config/forms/schema/test.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "$id": "https://example.com/product.schema.json", - "title": "Form", - "description": "A form", - "type": "object", - "required": ["form_type", "start_year", "end_year", "sections"], - "properties": { - "form_type": { - "description": "", - "type": "string" - }, - "start_year": { - "description": "", - "type": "integer" - }, - "end_year": { - "description": "", - "type": "integer" - }, - "sections": { - "type": "object", - "patternProperties": { - "[a-z_]+": { - "description": "", - "type": "object", - "properties": { - "label": { - "description": "", - "type": "string" - }, - "subsections": { - "type": "object", - "patternProperties": { - "[a-z_]+": { - "description": "", - "type": "object", - "required": ["label"], - "properties": { - "label": { - "description": "", - "type": "string" - }, - "pages": { - "type": "object", - "patternProperties": { - "[a-z_]+": { - "description": "", - "type": "object", - "properties": { - "header": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "questions": { - "type": "object", - "patternProperties": { - "[a-z_]+": { - "description": "", - "type": "object", - "required": ["header"], - "properties": { - "check_answer_label": { - "description": "", - "type": "string" - }, - "header": { - "description": "", - "type": "string" - }, - "type": { - "description": "", - "type": "string" - }, - "hint_text": { - "description": "", - "type": "string" - }, - "answer_options": { - "description": "", - "type": "string" - } - } - } - } - } - }, - "minProperties": 1 - } - } - } - }, - "minProperties": 1 - } - } - } - }, - "minProperties": 2 - } - }, - "minProperties": 1 - } - } -} \ No newline at end of file diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json deleted file mode 100644 index b5467a48f..000000000 --- a/spec/fixtures/forms/test_form.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "form_type": "lettings", - "start_year": 2021, - "end_year": 2022, - "sections": { - "household": { - "label": "About the household", - "subsections": { - "household_characteristics": { - "label": "Household characteristics", - "pages": { - } - } - } - } - } -} - \ No newline at end of file diff --git a/spec/fixtures/forms/test_validator.json b/spec/fixtures/forms/test_validator.json index e83c4d970..487b990f4 100644 --- a/spec/fixtures/forms/test_validator.json +++ b/spec/fixtures/forms/test_validator.json @@ -17,7 +17,8 @@ "header": "What is the tenant code?", "type": "text" } - } + }, + "conditional_route_to": {"test": "Yes"} } }, "person_1_age": {