diff --git a/app/helpers/json_schema_validation.rb b/app/helpers/json_schema_validation.rb index 086110c54..07ba995e6 100644 --- a/app/helpers/json_schema_validation.rb +++ b/app/helpers/json_schema_validation.rb @@ -14,7 +14,6 @@ end begin path = "config/forms/schema/generic.json" - # path = "config/forms/schema/2021_2022.json" file = File.open(path) schema = JSON.parse(file.read) diff --git a/config/forms/schema/generic.json b/config/forms/schema/generic.json index d7654e063..d9b0f8cc5 100644 --- a/config/forms/schema/generic.json +++ b/config/forms/schema/generic.json @@ -44,7 +44,7 @@ "pages": { "type": "object", "patternProperties": { - "[a-z_]+": { + "^(?!(conditional_route_to))[a-z_]+$": { "description": "Page Name", "type": "object", "required": ["header", "questions"], @@ -88,6 +88,10 @@ "check_answer_label": { "description": "", "type": "string" + }, + "conditional_for": { + "description": "", + "type": "object" } }, "minProperties": 1 diff --git a/spec/fixtures/forms/test_validator.json b/spec/fixtures/forms/test_validator.json index 487b990f4..630145f35 100644 --- a/spec/fixtures/forms/test_validator.json +++ b/spec/fixtures/forms/test_validator.json @@ -11,6 +11,7 @@ "ShouldThrowError": "Shouldn't be here but what you gonna do?", "pages": { "tenant_code": { + "ShouldThrowError": "Shouldn't be here but what you gonna do?", "questions": { "tenant_code": { "check_answer_label": "Tenant code", @@ -19,7 +20,8 @@ } }, "conditional_route_to": {"test": "Yes"} - } + }, + "conditional_route_to": {"test": "Yes"} }, "person_1_age": { "header": "",