From ceb8ea03cb4d56f231441463781362e14eb9de2e Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 5 Nov 2021 17:06:13 +0000 Subject: [PATCH] and check schema --- app/helpers/json_schema_validation.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/helpers/json_schema_validation.rb b/app/helpers/json_schema_validation.rb index dcb0c20a4..4d947c450 100644 --- a/app/helpers/json_schema_validation.rb +++ b/app/helpers/json_schema_validation.rb @@ -55,12 +55,24 @@ begin "label": { "description": "", "type": "string" + }, + "subsections": { + "type": "object" } } } } } + metaschema = JSON::Validator.validator_for_name("draft4").metaschema + # => true + if JSON::Validator.validate(metaschema, schema) + puts "schema valid" + else + puts "schema not valid" + return + end + path = "spec/fixtures/forms/test_validator.json" # path = "config/forms/2021_2022.json"