lib/json-schema/attributes/formats/uri.rb in json-schema-2.5.0 vs lib/json-schema/attributes/formats/uri.rb in json-schema-2.5.1
- old
+ new
@@ -5,13 +5,10 @@
class UriFormat < FormatAttribute
def self.validate(current_schema, data, fragments, processor, validator, options = {})
return unless data.is_a?(String)
error_message = "The property '#{build_fragment(fragments)}' must be a valid URI"
begin
- # TODO
- # Addressable only throws an exception on to_s for invalid URI strings, although it
- # probably should throughout parse already - https://github.com/sporkmonger/addressable/issues/177
- Addressable::URI.parse(data).to_s
+ Addressable::URI.parse(data)
rescue Addressable::URI::InvalidURIError
validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
end
end
end