Module: OnestopIdRegistryValidator

Defined in:
lib/onestop_id_registry_validator.rb,
lib/onestop_id_registry_validator/version.rb,
lib/onestop_id_registry_validator/internal_validation.rb

Constant Summary collapse

VERSION =
'0.0.3'
ENTITIES_TO_VALIDATE =
[:feeds, :operators]

Class Method Summary collapse

Class Method Details

.validate_allObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/onestop_id_registry_validator/internal_validation.rb', line 36

def self.validate_all
  errors = {}
  ENTITIES_TO_VALIDATE.each do |entity_to_validate|
    OnestopIdClient::Registry.json_files_for_entity(entity_to_validate.to_s).each do |file_path|
      file = File.open(file_path, 'r')
      file_errors = validate(entity_to_validate, file.read)
      errors[File.basename(file)] = file_errors if file_errors && file_errors.length > 0
    end
  end
  if errors.length > 0
    puts errors.inspect
  else
    puts "All JSON feed definition files validated."
    Process.exit(0)
  end
end