|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
require "json" |
|
|
|
|
require "json-schema" |
|
|
|
|
|
|
|
|
|
# rubocop:disable Lint/ShadowingOuterLocalVariable |
|
|
|
|
def get_all_form_paths(directories) |
|
|
|
|
form_paths = [] |
|
|
|
|
directories.each do |directory| |
|
|
|
@ -13,8 +13,8 @@ end
|
|
|
|
|
|
|
|
|
|
namespace :form_definition do |
|
|
|
|
desc "Validate JSON against Generic Form Schema" |
|
|
|
|
task :validate do |
|
|
|
|
puts "#{Rails.root}" |
|
|
|
|
task validate: :environment do |
|
|
|
|
puts Rails.root.to_s |
|
|
|
|
path = "config/forms/schema/generic.json" |
|
|
|
|
|
|
|
|
|
file = File.open(path) |
|
|
|
@ -38,7 +38,7 @@ namespace :form_definition do
|
|
|
|
|
file = File.open(path) |
|
|
|
|
data = JSON.parse(file.read) |
|
|
|
|
|
|
|
|
|
puts JSON::Validator.fully_validate(schema, data, :strict => true) |
|
|
|
|
puts JSON::Validator.fully_validate(schema, data, strict: true) |
|
|
|
|
|
|
|
|
|
begin |
|
|
|
|
JSON::Validator.validate!(schema, data) |
|
|
|
@ -47,4 +47,5 @@ namespace :form_definition do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
# rubocop:enable Lint/ShadowingOuterLocalVariable |
|
|
|
|