Browse Source

change pattern to ignore conditional_route_to

pull/76/head
magicmilo 3 years ago
parent
commit
c67fccdcd0
  1. 1
      app/helpers/json_schema_validation.rb
  2. 6
      config/forms/schema/generic.json
  3. 4
      spec/fixtures/forms/test_validator.json

1
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)

6
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

4
spec/fixtures/forms/test_validator.json vendored

@ -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": "",

Loading…
Cancel
Save