Browse Source

update readme for schema validation

pull/76/head
magicmilo 3 years ago
parent
commit
bda09d7886
  1. 15
      README.md

15
README.md

@ -120,6 +120,7 @@ The JSON should follow the structure:
"[snake_case_question_name_string]": { "[snake_case_question_name_string]": {
"header": String, "header": String,
"hint_text": String, "hint_text": String,
"check_answer_label": String,
"type": "text" / "numeric" / "radio" / "checkbox" / "date", "type": "text" / "numeric" / "radio" / "checkbox" / "date",
"min": Integer, // numeric only "min": Integer, // numeric only
"max": Integer, // numeric only "max": Integer, // numeric only
@ -133,6 +134,10 @@ The JSON should follow the structure:
"[snake_case_question_to_enable_2_name_string]": ["condition-that-enables"] "[snake_case_question_to_enable_2_name_string]": ["condition-that-enables"]
} }
} }
},
"conditional_route_to": {
"[page_name_to_route_to]": {"question_name": "expected_answer"},
"[page_name_to_route_to]": {"question_name": "expected_answer"}
} }
} }
} }
@ -155,6 +160,16 @@ Assumptions made by the format:
- Radio question answer option selected matches one of conditional e.g. ["answer-options-1-string", "answer-option-3-string"] - Radio question answer option selected matches one of conditional e.g. ["answer-options-1-string", "answer-option-3-string"]
- Numeric question value matches condition e.g. [">2"], ["<7"] or ["== 6"] - Numeric question value matches condition e.g. [">2"], ["<7"] or ["== 6"]
## JSON Form Validation against Schema
To validate the form JSON against the schema you can run:
`ruby app/helpers/json_schema_validation.rb`
This will validate all forms in:
directories = ["config/forms", "spec/fixtures/forms"]
against the schema in (config/forms/schema/generic.json)
## Useful documentation (external dependencies) ## Useful documentation (external dependencies)
### GOV.UK Design System Form Builder for Rails ### GOV.UK Design System Form Builder for Rails

Loading…
Cancel
Save