From ebc79e49828f211dc4aaba62abdad535173cf0d9 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Mon, 8 Nov 2021 09:44:40 +0000 Subject: [PATCH] . --- app/helpers/json_schema_validation.rb | 4 ++-- config/forms/schema/generic.json | 6 ++++-- spec/fixtures/forms/test_validator.json | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/helpers/json_schema_validation.rb b/app/helpers/json_schema_validation.rb index 329186831..5435f02e6 100644 --- a/app/helpers/json_schema_validation.rb +++ b/app/helpers/json_schema_validation.rb @@ -36,8 +36,8 @@ end begin - # path = "config/forms/schema/generic.json" - path = "config/forms/schema/2021_2022.json" + 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 a52897c43..024990b8b 100644 --- a/config/forms/schema/generic.json +++ b/config/forms/schema/generic.json @@ -11,11 +11,13 @@ }, "start_year": { "description": "", - "type": "integer" + "type": "integer", + "optional": "true" }, "end_year": { "description": "", - "type": "integer" + "type": "integer", + "required": "false" }, "sections": { "description": "", diff --git a/spec/fixtures/forms/test_validator.json b/spec/fixtures/forms/test_validator.json index 13aed9e5f..e0fe13361 100644 --- a/spec/fixtures/forms/test_validator.json +++ b/spec/fixtures/forms/test_validator.json @@ -19,6 +19,21 @@ } } } + }, + "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 + } + } } } }