lib/fitting/response/fully_validates.rb in fitting-2.0.1 vs lib/fitting/response/fully_validates.rb in fitting-2.0.2
- old
+ new
@@ -4,11 +4,11 @@
class Response
class FullyValidates < Array
def self.craft(schemas, body, strict)
if schemas
new(schemas.inject([]) do |res, schema|
- res.push(JSON::Validator.fully_validate(schema, body, :strict => strict))
+ res.push(fully_validate(schema, body, strict))
end)
else
@valid = false
new
end
@@ -18,9 +18,17 @@
@valid ||= any? { |fully_validate| fully_validate == [] }
end
def to_s
@to_s ||= join("\n\n")
+ end
+
+ private
+
+ def self.fully_validate(schema, body, strict)
+ JSON::Validator.fully_validate(schema, body, :strict => strict)
+ rescue JSON::Schema::UriError
+ []
end
end
end
end