Sha256: fa6ec5b1c0f78b5334dce799e2a3e3d79ba77eda521019a275e656f4510281ad
Contents?: true
Size: 587 Bytes
Versions: 3
Compression:
Stored size: 587 Bytes
Contents
require 'json-schema/attribute' require 'uri' module JSON class Schema class UriFormat < FormatAttribute def self.validate(current_schema, data, fragments, processor, validator, options = {}) if data.is_a?(String) error_message = "The property '#{build_fragment(fragments)}' must be a valid URI" begin URI.parse(URI.escape(data)) rescue URI::InvalidURIError validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json-schema-2.4.1 | lib/json-schema/attributes/formats/uri.rb |
json-schema-2.4.0 | lib/json-schema/attributes/formats/uri.rb |
json-schema-2.3.0 | lib/json-schema/attributes/formats/uri.rb |