|
|
@ -12,7 +12,7 @@ def get_all_form_paths(directories) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
namespace :form_definition do |
|
|
|
namespace :form_definition do |
|
|
|
desc "Validate JSON against Generic Form Schema" |
|
|
|
desc "Validate all JSON against Generic Form Schema" |
|
|
|
|
|
|
|
|
|
|
|
task validate_all: :environment do |
|
|
|
task validate_all: :environment do |
|
|
|
directories = ["config/forms", "spec/fixtures/forms"] |
|
|
|
directories = ["config/forms", "spec/fixtures/forms"] |
|
|
@ -24,9 +24,9 @@ namespace :form_definition do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
task :validate, %i[path] => :environment do |_task, args| |
|
|
|
desc "Validate Single JSON against Generic Form Schema" |
|
|
|
puts args |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task :validate, %i[path] => :environment do |_task, args| |
|
|
|
path = Rails.root.join("config/forms/schema/generic.json") |
|
|
|
path = Rails.root.join("config/forms/schema/generic.json") |
|
|
|
file = File.open(path) |
|
|
|
file = File.open(path) |
|
|
|
schema = JSON.parse(file.read) |
|
|
|
schema = JSON.parse(file.read) |
|
|
@ -34,8 +34,6 @@ namespace :form_definition do |
|
|
|
|
|
|
|
|
|
|
|
puts path |
|
|
|
puts path |
|
|
|
|
|
|
|
|
|
|
|
binding.pry |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if JSON::Validator.validate(meta_schema, schema) |
|
|
|
if JSON::Validator.validate(meta_schema, schema) |
|
|
|
puts "Schema Definition is Valid" |
|
|
|
puts "Schema Definition is Valid" |
|
|
|
else |
|
|
|
else |
|
|
|