Skip to content

Commit

Permalink
wiki: Use JSON::Validator.fully_validate()
Browse files Browse the repository at this point in the history
This doesn't exit at first error and gives us a lot more helpful errors
while at it.

Change-Id: I09ae8c507296722f24b3af8e663a12e544d0b6a4
  • Loading branch information
luk1337 committed Aug 18, 2024
1 parent 432e5ce commit fcf87dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def to_relative_path(path)
end

def validate_json(schema, device_json, device_path)
JSON::Validator.validate!(schema, device_json, :validate_schema => true)
rescue JSON::Schema::ValidationError, Psych::SyntaxError => e
puts to_relative_path(device_path) + ': ' + e.message
at_exit { exit false }
JSON::Validator.fully_validate(schema, device_json, :validate_schema => true).each do |message|
puts to_relative_path(device_path) + ': ' + message
at_exit { exit false }
end
end

def validate_image(path, device_path)
Expand Down

0 comments on commit fcf87dd

Please sign in to comment.